[vlc-commits] aout: fix INT64_MAX comparaison

Thomas Guillem git at videolan.org
Fri Aug 21 09:41:57 CEST 2020


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Aug 13 09:47:45 2020 +0200| [ff70ad9aa7c004c2b32dd9a8043102fa7e48d00e] | committer: Thomas Guillem

aout: fix INT64_MAX comparaison

-drift was never equal to INT64_MAX.

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

 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 7aba7ae8db..40eb33995f 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



More information about the vlc-commits mailing list