[vlc-devel] [PATCH] aout: fix INT64_MAX comparaison

Thomas Guillem thomas at gllm.fr
Thu Aug 13 10:02:20 CEST 2020


-drift was never equal to INT64_MAX.
---
 src/audio_output/dec.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index faa65b4d792..8bf7a435767 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -318,11 +318,17 @@ void aout_RequestRetiming(audio_output_t *aout, vlc_tick_t system_ts,
     aout_owner_t *owner = aout_owner (aout);
     float rate = owner->sync.rate;
     vlc_tick_t drift =
-        -vlc_clock_Update(owner->sync.clock, system_ts, audio_ts, rate);
+        vlc_clock_Update(owner->sync.clock, system_ts, audio_ts, rate);
 
     if (unlikely(drift == INT64_MAX) || owner->bitexact)
         return; /* cf. INT64_MAX comment in aout_DecPlay() */
 
+    /* Following calculations expect an opposite drift. Indeed,
+     * vlc_clock_Update() returns a positive relative time, corresponding to
+     * the time when audio_ts is expected to be played (in the future when not
+     * late). */
+    drift = -drift;
+
     /* 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
-- 
2.28.0



More information about the vlc-devel mailing list