[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/3] dsoundaudio: fix never-ending playback loop
From: |
Volker Rümelin |
Subject: |
[PATCH 1/3] dsoundaudio: fix never-ending playback loop |
Date: |
Wed, 1 Apr 2020 21:00:15 +0200 |
Currently the DirectSound backend fails to stop audio playback
in dsound_enable_out(). The call to IDirectSoundBuffer_GetStatus()
in dsound_get_status_out() returns a status word with the flag
DSERR_BUFFERLOST set (probably because of a buffer underrun).
The function dsound_get_status_out() correctly calls
dsound_restore_out() and returns an error. This is wrong. If
dsound_restore_out() succeeds the program should continue without
an error.
To reproduce the bug start qemu on a Windows host with
-soundhw pcspk -audiodev dsound,id=audio0. On the guest
FreeDOS 1.2 command line enter beep. The image Day 1 - F-Bird
from the QEMU Advent Calendar 2018 shows the bug as well.
Fixes: 2762955f72 "dsoundaudio: remove *_retries kludges"
Buglink: https://bugs.launchpad.net/qemu/+bug/1699628
Signed-off-by: Volker Rümelin <address@hidden>
---
audio/dsoundaudio.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c
index bd57082a8d..af70dd128e 100644
--- a/audio/dsoundaudio.c
+++ b/audio/dsoundaudio.c
@@ -280,8 +280,10 @@ static int dsound_get_status_out (LPDIRECTSOUNDBUFFER dsb,
DWORD *statusp,
}
if (*statusp & DSERR_BUFFERLOST) {
- dsound_restore_out(dsb, s);
- return -1;
+ if (dsound_restore_out(dsb, s)) {
+ return -1;
+ }
+ *statusp &= ~DSERR_BUFFERLOST;
}
return 0;
--
2.16.4