diff options
author | Kővágó, Zoltán <dirty.ice.hu@gmail.com> | 2020-02-03 00:02:23 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2020-02-06 14:31:20 +0100 |
commit | fb35c2cec58985f0b8d2733f1b91927542eeb3fd (patch) | |
tree | fe30d5f05ca1fde9d8d2c9a6f3bf1de3f4db0599 /audio/audio.c | |
parent | 599eac4e5a41e828645594097daee39373acc3c0 (diff) | |
download | qemu-fb35c2cec58985f0b8d2733f1b91927542eeb3fd.zip qemu-fb35c2cec58985f0b8d2733f1b91927542eeb3fd.tar.gz qemu-fb35c2cec58985f0b8d2733f1b91927542eeb3fd.tar.bz2 |
audio/dsound: fix invalid parameters error
Windows (unlike wine) bails out when IDirectSoundBuffer8::Lock is called
with zero length. Also, hw->pos_emul handling was incorrect when
calling this function for the first time.
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Reported-by: KJ Liew <liewkj@yahoo.com>
Tested-by: Howard Spoelstra <hsp.cat7@gmail.com>
Message-id: fe9744216d9d421a2dbb09bcf5fa0dbd18f77ac5.1580684275.git.DirtY.iCE.hu@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio/audio.c')
-rw-r--r-- | audio/audio.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/audio/audio.c b/audio/audio.c index f985940..3bfd808 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1076,10 +1076,8 @@ static size_t audio_pcm_hw_run_out(HWVoiceOut *hw, size_t live) while (live) { size_t size, decr, proc; void *buf = hw->pcm_ops->get_buffer_out(hw, &size); - if (!buf) { - /* retrying will likely won't help, drop everything. */ - hw->mix_buf->pos = (hw->mix_buf->pos + live) % hw->mix_buf->size; - return clipped + live; + if (!buf || size == 0) { + break; } decr = MIN(size / hw->info.bytes_per_frame, live); |