[client] audio/pa: fix assertion failure when keep alive playback stops

When the 'keep alive' playback times out, playback is stopped from the
audio callback, resulting in an assertion failure inside PulseAudio as we
try to lock the main loop thread while already inside it.
This commit is contained in:
Chris Spencer 2022-02-20 16:51:33 +00:00 committed by Geoffrey McRae
parent 38340d3497
commit 84b5478b02

View File

@ -313,10 +313,15 @@ static void pulseaudio_stop(void)
if (!pa.sink)
return;
pa_threaded_mainloop_lock(pa.loop);
bool needLock = !pa_threaded_mainloop_in_thread(pa.loop);
if (needLock)
pa_threaded_mainloop_lock(pa.loop);
pa_stream_cork(pa.sink, 1, NULL, NULL);
pa.sinkCorked = true;
pa_threaded_mainloop_unlock(pa.loop);
if (needLock)
pa_threaded_mainloop_unlock(pa.loop);
}
static void pulseaudio_volume(int channels, const uint16_t volume[])