[vlc-commits] pulse: fix playback with very small inputs

Thomas Guillem git at videolan.org
Fri Jul 12 14:37:47 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jul 12 13:08:40 2019 +0200| [0a1a317c452ea9c45ace3a485419010a449947f8] | committer: Thomas Guillem

pulse: fix playback with very small inputs

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0a1a317c452ea9c45ace3a485419010a449947f8
---

 modules/audio_output/pulse.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index 1091affcac..fba8fd6840 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -555,6 +555,21 @@ static void Drain(audio_output_t *aout)
     pa_stream *s = sys->stream;
 
     pa_threaded_mainloop_lock(sys->mainloop);
+
+    if (unlikely(pa_stream_is_corked(s) > 0))
+    {
+        /* Drain while the stream is corked. It happens with very small input
+         * when the stream is drained while the start is still being deferred.
+         * In that case, we need start the stream before we actually drain it.
+         * */
+        if (sys->trigger != NULL)
+        {
+            vlc_pa_rttime_free(sys->mainloop, sys->trigger);
+            sys->trigger = NULL;
+        }
+        stream_start_now(s, aout);
+    }
+
     pa_operation *op = pa_stream_drain(s, NULL, NULL);
     if (op != NULL)
         pa_operation_unref(op);



More information about the vlc-commits mailing list