[vlc-devel] [PATCH] pulse: fix playback with very small inputs
Thomas Guillem
thomas at gllm.fr
Fri Jul 12 13:14:12 CEST 2019
---
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);
--
2.20.1
More information about the vlc-devel
mailing list