[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 5/6] paaudio: wait until the recording stream is ready
From: |
Gerd Hoffmann |
Subject: |
[PULL 5/6] paaudio: wait until the recording stream is ready |
Date: |
Mon, 6 Jan 2020 13:52:35 +0100 |
From: Volker RĂ¼melin <address@hidden>
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 <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
audio/paaudio.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/audio/paaudio.c b/audio/paaudio.c
index b23274550e1c..dbfe48c03a1d 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.18.1
- [PULL 0/6] Audio 20200106 patches, Gerd Hoffmann, 2020/01/06
- [PULL 2/6] hda-codec: fix recording rate control, Gerd Hoffmann, 2020/01/06
- [PULL 4/6] paaudio: try to drain the recording stream, Gerd Hoffmann, 2020/01/06
- [PULL 1/6] hda-codec: fix playback rate control, Gerd Hoffmann, 2020/01/06
- [PULL 5/6] paaudio: wait until the recording stream is ready,
Gerd Hoffmann <=
- [PULL 6/6] audio: fix integer overflow, Gerd Hoffmann, 2020/01/06
- [PULL 3/6] paaudio: drop recording stream in qpa_fini_in, Gerd Hoffmann, 2020/01/06
- Re: [PULL 0/6] Audio 20200106 patches, Peter Maydell, 2020/01/06