From 7230d88c7ed83e17766611c3381513225be9248a Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 23 Sep 2014 22:47:32 +0200 Subject: ao_pulse: correctly wait for stream state This works similar to condition variables; for some reason this apparently worked fine until now, but it breaks with passthrough mode. --- audio/out/ao_pulse.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/audio/out/ao_pulse.c b/audio/out/ao_pulse.c index 1591ba6e3f..8648bd5019 100644 --- a/audio/out/ao_pulse.c +++ b/audio/out/ao_pulse.c @@ -380,7 +380,14 @@ static int init(struct ao *ao) goto unlock_and_fail; /* Wait until the stream is ready */ - pa_threaded_mainloop_wait(priv->mainloop); + while (1) { + int state = pa_stream_get_state(priv->stream); + if (state == PA_STREAM_READY) + break; + if (!PA_STREAM_IS_GOOD(state)) + goto unlock_and_fail; + pa_threaded_mainloop_wait(priv->mainloop); + } if (pa_stream_get_state(priv->stream) != PA_STREAM_READY) goto unlock_and_fail; -- cgit v1.2.3