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 v2 5/5] paaudio: wait until the recording stream is ready
Date: Sat, 4 Jan 2020 10:11:22 +0100 [thread overview]
Message-ID: <20200104091122.13971-5-vr_qemu@t-online.de> (raw)
In-Reply-To: <07d61da6-51fb-8599-ea27-dae828fbdb3c@t-online.de>
Don't call pa_stream_peek before the recording stream is ready.
Information to reproduce the problem.
Start and stop Audacity in the guest several times because the
problem is racy.
libvirt log file:
-audiodev pa,id=audio0,server=localhost,out.latency=30000,
out.mixing-engine=off,in.mixing-engine=off \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,
resourcecontrol=deny \
-msg timestamp=on
: Domain id=4 is tainted: custom-argv
char device redirected to /dev/pts/1 (label charserial0)
audio: Device pcspk: audiodev default parameter is deprecated,
please specify audiodev=audio0
audio: Device hda: audiodev default parameter is deprecated,
please specify audiodev=audio0
pulseaudio: pa_stream_peek failed
pulseaudio: Reason: Bad state
pulseaudio: pa_stream_peek failed
pulseaudio: Reason: Bad state
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
---
audio/paaudio.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/audio/paaudio.c b/audio/paaudio.c
index b23274550e..dbfe48c03a 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -162,6 +162,10 @@ static size_t qpa_read(HWVoiceIn *hw, void *data, size_t length)
CHECK_DEAD_GOTO(c, p->stream, unlock_and_fail,
"pa_threaded_mainloop_lock failed\n");
+ if (pa_stream_get_state(p->stream) != PA_STREAM_READY) {
+ /* wait for stream to become ready */
+ goto unlock;
+ }
while (total < length) {
size_t l;
@@ -191,6 +195,7 @@ static size_t qpa_read(HWVoiceIn *hw, void *data, size_t length)
}
}
+unlock:
pa_threaded_mainloop_unlock(c->mainloop);
return total;
--
2.16.4
prev parent reply other threads:[~2020-01-04 9:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-04 9:07 [PATCH v2 0/5] audio fixes Volker Rümelin
2020-01-04 9:11 ` [PATCH v2 1/5] hda-codec: fix playback rate control Volker Rümelin
2020-01-04 9:11 ` [PATCH v2 2/5] hda-codec: fix recording " Volker Rümelin
2020-01-04 9:11 ` [PATCH v2 3/5] paaudio: drop recording stream in qpa_fini_in Volker Rümelin
2020-01-04 9:11 ` [PATCH v2 4/5] paaudio: try to drain the recording stream Volker Rümelin
2020-01-04 9:11 ` Volker Rümelin [this message]
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=20200104091122.13971-5-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).