mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-28 12:32:05 -06:00
paaudio: drop recording stream in qpa_fini_in
Every call to pa_stream_peek which returns a data length > 0 should have a corresponding pa_stream_drop. A call to qpa_read does not necessarily call pa_stream_drop immediately after a call to pa_stream_peek. Test in qpa_fini_in if a last pa_stream_drop is needed. This prevents following messages in the libvirt log file after a recording stream gets closed and a new one opened. pulseaudio: pa_stream_drop failed pulseaudio: Reason: Bad state pulseaudio: pa_stream_drop failed pulseaudio: Reason: Bad state To reproduce start qemu with -audiodev pa,id=audio0,in.mixing-engine=off and in the guest start and stop Audacity several times. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 20200104091122.13971-3-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
c435fea72b
commit
4db3e634c7
1 changed files with 18 additions and 4 deletions
|
@ -536,7 +536,6 @@ static void qpa_simple_disconnect(PAConnection *c, pa_stream *stream)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
pa_threaded_mainloop_lock(c->mainloop);
|
|
||||||
/*
|
/*
|
||||||
* wait until actually connects. workaround pa bug #247
|
* wait until actually connects. workaround pa bug #247
|
||||||
* https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/247
|
* https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/247
|
||||||
|
@ -550,7 +549,6 @@ static void qpa_simple_disconnect(PAConnection *c, pa_stream *stream)
|
||||||
dolog("Failed to disconnect! err=%d\n", err);
|
dolog("Failed to disconnect! err=%d\n", err);
|
||||||
}
|
}
|
||||||
pa_stream_unref(stream);
|
pa_stream_unref(stream);
|
||||||
pa_threaded_mainloop_unlock(c->mainloop);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qpa_fini_out (HWVoiceOut *hw)
|
static void qpa_fini_out (HWVoiceOut *hw)
|
||||||
|
@ -558,8 +556,12 @@ static void qpa_fini_out (HWVoiceOut *hw)
|
||||||
PAVoiceOut *pa = (PAVoiceOut *) hw;
|
PAVoiceOut *pa = (PAVoiceOut *) hw;
|
||||||
|
|
||||||
if (pa->stream) {
|
if (pa->stream) {
|
||||||
qpa_simple_disconnect(pa->g->conn, pa->stream);
|
PAConnection *c = pa->g->conn;
|
||||||
|
|
||||||
|
pa_threaded_mainloop_lock(c->mainloop);
|
||||||
|
qpa_simple_disconnect(c, pa->stream);
|
||||||
pa->stream = NULL;
|
pa->stream = NULL;
|
||||||
|
pa_threaded_mainloop_unlock(c->mainloop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,8 +570,20 @@ static void qpa_fini_in (HWVoiceIn *hw)
|
||||||
PAVoiceIn *pa = (PAVoiceIn *) hw;
|
PAVoiceIn *pa = (PAVoiceIn *) hw;
|
||||||
|
|
||||||
if (pa->stream) {
|
if (pa->stream) {
|
||||||
qpa_simple_disconnect(pa->g->conn, pa->stream);
|
PAConnection *c = pa->g->conn;
|
||||||
|
|
||||||
|
pa_threaded_mainloop_lock(c->mainloop);
|
||||||
|
if (pa->read_length) {
|
||||||
|
int r = pa_stream_drop(pa->stream);
|
||||||
|
if (r) {
|
||||||
|
qpa_logerr(pa_context_errno(c->context),
|
||||||
|
"pa_stream_drop failed\n");
|
||||||
|
}
|
||||||
|
pa->read_length = 0;
|
||||||
|
}
|
||||||
|
qpa_simple_disconnect(c, pa->stream);
|
||||||
pa->stream = NULL;
|
pa->stream = NULL;
|
||||||
|
pa_threaded_mainloop_unlock(c->mainloop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue