summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormalc <av1474@comtv.ru>2010-01-09 18:06:54 +0300
committerAurelien Jarno <aurelien@aurel32.net>2010-04-25 12:20:10 +0200
commit2b8bdd5c7fc3f4de476b5c4d48ea702a220a7461 (patch)
treeefd15f16ebb52edec1beaee9858a213b6b44b961
parentoss: issue OSS_GETVERSION ioctl only when needed (diff)
downloadqemu-kvm-2b8bdd5c7fc3f4de476b5c4d48ea702a220a7461.tar.gz
qemu-kvm-2b8bdd5c7fc3f4de476b5c4d48ea702a220a7461.tar.bz2
qemu-kvm-2b8bdd5c7fc3f4de476b5c4d48ea702a220a7461.zip
oss: fix fragment setting
Previous patch introduced subtle regression, in cases when OSS_GETVERSION fails the code wasn't falling back to SNDCTL_DSP_SETFRAGMENT. Signed-off-by: malc <av1474@comtv.ru> (cherry picked from commit 3d709fe73a77c40e263b3af6e650fd4b519c3562)
-rw-r--r--audio/ossaudio.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index 79d1daa1c..ebf8b2397 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -247,6 +247,7 @@ static int oss_open (int in, struct oss_params *req,
int oflags = conf.exclusive ? O_EXCL : 0;
audio_buf_info abinfo;
int fmt, freq, nchannels;
+ int setfragment = 1;
const char *dspname = in ? conf.devpath_in : conf.devpath_out;
const char *typ = in ? "ADC" : "DAC";
@@ -290,25 +291,27 @@ static int oss_open (int in, struct oss_params *req,
if (ioctl (fd, OSS_GETVERSION, &version)) {
oss_logerr2 (errno, typ, "Failed to get OSS version\n");
- version = 0;
- }
-
- if (conf.debug) {
- dolog ("OSS version = %#x\n", version);
}
+ else {
+ if (conf.debug) {
+ dolog ("OSS version = %#x\n", version);
+ }
- if (version >= 0x040000) {
- int policy = conf.policy;
- if (ioctl (fd, SNDCTL_DSP_POLICY, &policy)) {
- oss_logerr2 (errno, typ, "Failed to set timing policy to %d\n",
- conf.policy);
- goto err;
+ if (version >= 0x040000) {
+ int policy = conf.policy;
+ if (ioctl (fd, SNDCTL_DSP_POLICY, &policy)) {
+ oss_logerr2 (errno, typ,
+ "Failed to set timing policy to %d\n",
+ conf.policy);
+ goto err;
+ }
+ setfragment = 0;
}
}
}
- else
#endif
- {
+
+ if (setfragment) {
int mmmmssss = (req->nfrags << 16) | ctz32 (req->fragsize);
if (ioctl (fd, SNDCTL_DSP_SETFRAGMENT, &mmmmssss)) {
oss_logerr2 (errno, typ, "Failed to set buffer length (%d, %d)\n",