[vlc-devel] [PATCH 4/4] RFC: aout: pulse: handle discontinuity
Thomas Guillem
thomas at gllm.fr
Wed Jan 30 12:28:13 CET 2019
No sure if really needed, since there is only one audio codec module that pass
the discontinuity flag: the faad module.
On other cases, a flush will always predate a discontinuity and this code path
won't be triggered.
---
modules/audio_output/pulse.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index 4ddc3ba7c8..21463628ab 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -527,6 +527,14 @@ static void Play(audio_output_t *aout, block_t *block, vlc_tick_t date)
* will take place, and sooner or later a deadlock. */
pa_threaded_mainloop_lock(sys->mainloop);
+ if (unlikely(block->i_flags & BLOCK_FLAG_DISCONTINUITY
+ && sys->last_date != VLC_TICK_INVALID))
+ {
+ /* Discontinuity, so the next block is likely in the future, drain the
+ * stream and defer the next start. */
+ FlushLocked(aout, true);
+ }
+
sys->last_date = date;
if (pa_stream_is_corked(s) > 0)
--
2.20.1
More information about the vlc-devel
mailing list