From 290badea95fb7a971fbf6efdf792cc322128098a Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 21 Jan 2015 22:02:02 -0800 Subject: Ensure PulseAudio's mixing loop is signaled when stopping --- Alc/backends/pulseaudio.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Alc/backends/pulseaudio.c') diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c index ae7e4e85..f8761c91 100644 --- a/Alc/backends/pulseaudio.c +++ b/Alc/backends/pulseaudio.c @@ -1053,6 +1053,14 @@ static void ALCpulsePlayback_stop(ALCpulsePlayback *self) return; self->killNow = AL_TRUE; + /* Signal the main loop in case PulseAudio isn't sending us audio requests + * (e.g. if the device is suspended). We need to lock the mainloop in case + * the mixer is between checking the killNow flag but before waiting for + * the signal. + */ + pa_threaded_mainloop_lock(self->loop); + pa_threaded_mainloop_unlock(self->loop); + pa_threaded_mainloop_signal(self->loop, 0); althrd_join(self->thread, &res); pa_threaded_mainloop_lock(self->loop); -- cgit v1.2.3