[vlc-commits] input_clock: set the final i_late version early

Steve Lhomme git at videolan.org
Mon Aug 17 16:14:26 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Aug 11 13:53:09 2020 +0200| [3713d3c276b69fb812a416f526c890e3d4046698] | committer: Steve Lhomme

input_clock: set the final i_late version early

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

 src/clock/input_clock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/clock/input_clock.c b/src/clock/input_clock.c
index a143f02fc6..b5472b3385 100644
--- a/src/clock/input_clock.c
+++ b/src/clock/input_clock.c
@@ -270,7 +270,7 @@ vlc_tick_t input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
     /* It does not take the decoder latency into account but it is not really
      * the goal of the clock here */
     const vlc_tick_t i_system_expected = ClockStreamToSystem( cl, i_ck_stream + AvgGet( &cl->drift ) );
-    const vlc_tick_t i_late = ( i_ck_system - cl->i_pts_delay ) - i_system_expected;
+    const vlc_tick_t i_late = __MAX(0, ( i_ck_system - cl->i_pts_delay ) - i_system_expected);
     if( i_late > 0 )
     {
         cl->late.pi_value[cl->late.i_index] = i_late;
@@ -279,7 +279,7 @@ vlc_tick_t input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
 
     vlc_mutex_unlock( &cl->lock );
 
-    return i_late > 0 ? i_late : 0;
+    return i_late;
 }
 
 /*****************************************************************************



More information about the vlc-commits mailing list