[vlc-commits] aout: handle the case where the clock is paused

Thomas Guillem git at videolan.org
Mon Sep 23 13:36:04 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Sep  5 11:38:43 2019 +0200| [91ebbcb53568743b2cac96de83486138a12b8e5d] | committer: Thomas Guillem

aout: handle the case where the clock is paused

This case can happen during a very short timespan, when the clock is paused
before the aout processed the pause event.

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

 src/audio_output/dec.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index e0c9f32b7e..05e3d355d7 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -307,6 +307,9 @@ void aout_RequestRetiming(audio_output_t *aout, vlc_tick_t system_ts,
     vlc_tick_t drift =
         -vlc_clock_Update(owner->sync.clock, system_ts, audio_ts, rate);
 
+    if (unlikely(drift == INT64_MAX))
+        return; /* cf. INT64_MAX comment in aout_DecPlay() */
+
     /* Late audio output.
      * This can happen due to insufficient caching, scheduling jitter
      * or bug in the decoder. Ideally, the output would seek backward. But that
@@ -456,9 +459,16 @@ int aout_DecPlay(audio_output_t *aout, block_t *block)
     vlc_tick_t system_now = vlc_tick_now();
     aout_DecSynchronize(aout, system_now, original_pts);
 
-    const vlc_tick_t play_date =
+    vlc_tick_t play_date =
         vlc_clock_ConvertToSystem(owner->sync.clock, system_now, original_pts,
                                   owner->sync.rate);
+    if (unlikely(play_date == INT64_MAX))
+    {
+        /* The clock is paused but not the output, play the audio anyway since
+         * we can't delay audio playback from here. */
+        play_date = system_now;
+
+    }
     /* Output */
     owner->sync.discontinuity = false;
     aout->play(aout, block, play_date);



More information about the vlc-commits mailing list