mmap audio fix (malc)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1138 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
15b6147000
commit
44a095a77c
@ -370,25 +370,25 @@ static int oss_hw_init (HWVoice *hw, int freq, int nchannels, audfmt_e fmt)
|
|||||||
if (oss->pcm_buf == MAP_FAILED) {
|
if (oss->pcm_buf == MAP_FAILED) {
|
||||||
dolog ("Failed to mmap OSS device\nReason: %s\n",
|
dolog ("Failed to mmap OSS device\nReason: %s\n",
|
||||||
errstr ());
|
errstr ());
|
||||||
} else for (;;) {
|
} else {
|
||||||
int err;
|
int err;
|
||||||
int trig = 0;
|
int trig = 0;
|
||||||
if (ioctl (oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {
|
if (ioctl (oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {
|
||||||
dolog ("SNDCTL_DSP_SETTRIGGER 0 failed\nReason: %s\n",
|
dolog ("SNDCTL_DSP_SETTRIGGER 0 failed\nReason: %s\n",
|
||||||
errstr ());
|
errstr ());
|
||||||
goto fail;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
trig = PCM_ENABLE_OUTPUT;
|
trig = PCM_ENABLE_OUTPUT;
|
||||||
if (ioctl (oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {
|
if (ioctl (oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {
|
||||||
dolog ("SNDCTL_DSP_SETTRIGGER PCM_ENABLE_OUTPUT failed\n"
|
dolog ("SNDCTL_DSP_SETTRIGGER PCM_ENABLE_OUTPUT failed\n"
|
||||||
"Reason: %s\n", errstr ());
|
"Reason: %s\n", errstr ());
|
||||||
goto fail;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
oss->mmapped = 1;
|
oss->mmapped = 1;
|
||||||
break;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fail:
|
if (!oss->mmapped) {
|
||||||
err = munmap (oss->pcm_buf, hw->bufsize);
|
err = munmap (oss->pcm_buf, hw->bufsize);
|
||||||
if (err) {
|
if (err) {
|
||||||
dolog ("Failed to unmap OSS device\nReason: %s\n",
|
dolog ("Failed to unmap OSS device\nReason: %s\n",
|
||||||
@ -396,6 +396,7 @@ static int oss_hw_init (HWVoice *hw, int freq, int nchannels, audfmt_e fmt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!oss->mmapped) {
|
if (!oss->mmapped) {
|
||||||
oss->pcm_buf = qemu_mallocz (hw->bufsize);
|
oss->pcm_buf = qemu_mallocz (hw->bufsize);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user