diff options
author | malc <av1474@comtv.ru> | 2010-01-09 17:54:07 +0300 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2010-04-25 12:20:01 +0200 |
commit | 2a444947268503e5fa70297de398b813a8ee3b25 (patch) | |
tree | aee3f08496c14f3155d74824ce79f9b763788ad0 /audio | |
parent | oss: refactor code around policy setting (diff) | |
download | qemu-kvm-2a444947268503e5fa70297de398b813a8ee3b25.tar.gz qemu-kvm-2a444947268503e5fa70297de398b813a8ee3b25.tar.bz2 qemu-kvm-2a444947268503e5fa70297de398b813a8ee3b25.zip |
oss: issue OSS_GETVERSION ioctl only when needed
Signed-off-by: malc <av1474@comtv.ru>
(cherry picked from commit 6d246526ce3c145b2831285def6983f5de6190d3)
Diffstat (limited to 'audio')
-rw-r--r-- | audio/ossaudio.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/audio/ossaudio.c b/audio/ossaudio.c index fe6fb523b..79d1daa1c 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -244,9 +244,6 @@ static int oss_open (int in, struct oss_params *req, struct oss_params *obt, int *pfd) { int fd; -#ifdef USE_DSP_POLICY - int version; -#endif int oflags = conf.exclusive ? O_EXCL : 0; audio_buf_info abinfo; int fmt, freq, nchannels; @@ -288,22 +285,25 @@ static int oss_open (int in, struct oss_params *req, } #ifdef USE_DSP_POLICY - if (ioctl (fd, OSS_GETVERSION, &version)) { - oss_logerr2 (errno, typ, "Failed to get OSS version\n"); - version = 0; - } + if (conf.policy >= 0) { + int version; - if (conf.debug) { - dolog ("OSS version = %#x\n", version); - } + if (ioctl (fd, OSS_GETVERSION, &version)) { + oss_logerr2 (errno, typ, "Failed to get OSS version\n"); + version = 0; + } - if (conf.policy >= 0 && 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 (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; + } } } else |