From: "Volker Rümelin" <vr_qemu@t-online.de>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: QEMU <qemu-devel@nongnu.org>, "Zoltán Kővágó" <dirty.ice.hu@gmail.com>
Subject: [PATCH 1/3] dsoundaudio: fix never-ending playback loop
Date: Wed, 1 Apr 2020 21:00:15 +0200 [thread overview]
Message-ID: <20200401190017.5081-1-vr_qemu@t-online.de> (raw)
In-Reply-To: <19cd6a5a-97b7-b684-f026-11d82e34dab9@t-online.de>
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 <vr_qemu@t-online.de>
---
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
next prev parent reply other threads:[~2020-04-01 19:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-01 18:59 [PATCH 0/3] DirectSound fixes for 5.0 Volker Rümelin
2020-04-01 19:00 ` Volker Rümelin [this message]
2020-04-01 19:00 ` [PATCH 2/3] dsoundaudio: fix "Could not lock capture buffer" warning Volker Rümelin
2020-04-01 19:00 ` [PATCH 3/3] dsoundaudio: dsound_get_buffer_in should honor *size Volker Rümelin
2020-04-01 21:58 ` [PATCH 0/3] DirectSound fixes for 5.0 Volker Rümelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200401190017.5081-1-vr_qemu@t-online.de \
--to=vr_qemu@t-online.de \
--cc=dirty.ice.hu@gmail.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).