[vlc-devel] [PATCH 2/2] pulse: fix drain with a workaround

Thomas Guillem thomas at gllm.fr
Sat Sep 2 15:40:34 CEST 2017


Fixes #18141
---
 modules/audio_output/pulse.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index fb70933f38..a1d7a03e46 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -560,8 +560,15 @@ static void Flush(audio_output_t *aout, bool wait)
     pa_threaded_mainloop_lock(sys->mainloop);
 
     if (wait)
+    {
         op = pa_stream_drain(s, NULL, NULL);
-        /* TODO: wait for drain completion*/
+
+        /* XXX: Loosy drain emulation.
+         * See #18141: drain callback is never received */
+        mtime_t delay;
+        while (TimeGet(aout, &delay) == 0 && delay > 0)
+            msleep(delay);
+    }
     else
         op = pa_stream_flush(s, NULL, NULL);
     if (op != NULL)
-- 
2.11.0



More information about the vlc-devel mailing list