diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-11-14 16:02:51 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-11-14 16:02:51 +0000 |
commit | 44a095a77ce7a4708e275df727667898e1e07c19 (patch) | |
tree | 84d04cf9ff1fd61679acd7590a6ce11a836fba1a /audio | |
parent | 15b614700062dde8801762b1cfd4717a63a2cfd9 (diff) | |
download | qemu-44a095a77ce7a4708e275df727667898e1e07c19.zip qemu-44a095a77ce7a4708e275df727667898e1e07c19.tar.gz qemu-44a095a77ce7a4708e275df727667898e1e07c19.tar.bz2 |
mmap audio fix (malc)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1138 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'audio')
-rw-r--r-- | audio/ossaudio.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/audio/ossaudio.c b/audio/ossaudio.c index 79b1e8a..ee897c9 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -370,29 +370,30 @@ static int oss_hw_init (HWVoice *hw, int freq, int nchannels, audfmt_e fmt) if (oss->pcm_buf == MAP_FAILED) { dolog ("Failed to mmap OSS device\nReason: %s\n", errstr ()); - } else for (;;) { + } else { int err; int trig = 0; if (ioctl (oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) { dolog ("SNDCTL_DSP_SETTRIGGER 0 failed\nReason: %s\n", errstr ()); - goto fail; } - - trig = PCM_ENABLE_OUTPUT; - if (ioctl (oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) { - dolog ("SNDCTL_DSP_SETTRIGGER PCM_ENABLE_OUTPUT failed\n" - "Reason: %s\n", errstr ()); - goto fail; + else { + trig = PCM_ENABLE_OUTPUT; + if (ioctl (oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) { + dolog ("SNDCTL_DSP_SETTRIGGER PCM_ENABLE_OUTPUT failed\n" + "Reason: %s\n", errstr ()); + } + else { + oss->mmapped = 1; + } } - oss->mmapped = 1; - break; - fail: - err = munmap (oss->pcm_buf, hw->bufsize); - if (err) { - dolog ("Failed to unmap OSS device\nReason: %s\n", - errstr ()); + if (!oss->mmapped) { + err = munmap (oss->pcm_buf, hw->bufsize); + if (err) { + dolog ("Failed to unmap OSS device\nReason: %s\n", + errstr ()); + } } } } |