summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-09-23 22:47:32 +0200
committerwm4 <wm4@nowhere>2014-09-23 23:11:55 +0200
commit7230d88c7ed83e17766611c3381513225be9248a (patch)
tree1137959e7dbd08a9071e5d83dc1e46076e177b2e /audio
parent601fb2f93a1afa261a073665146587d16848086b (diff)
downloadmpv-7230d88c7ed83e17766611c3381513225be9248a.tar.bz2
mpv-7230d88c7ed83e17766611c3381513225be9248a.tar.xz
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.
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao_pulse.c9
1 files changed, 8 insertions, 1 deletions
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;