[vlc-commits] [Git][videolan/vlc][master] 2 commits: input_clock: add an intermediate rate variable

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Jul 22 16:08:22 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
b848b8de by Thomas Guillem at 2024-07-22T15:27:48+00:00
input_clock: add an intermediate rate variable

No functional changes, this is needed by the next commit as
UpdateListener() use cl->rate (and need to be up to date).

- - - - -
47da1c71 by Thomas Guillem at 2024-07-22T15:27:48+00:00
input_clock: don't update invalid points on rate change

Only call UpdateListener() if the clock is valid.

This fixes the following assert:

vlc: ../../src/clock/clock.c:585: vlc_clock_monotonic_to_system: Assertion `ctx->wait_sync_ref.stream != VLC_TICK_INVALID' failed.

This was occurring after a pause, a flush and a resume (that triggers a
rate change).

The assertion is new, but VLC_TICK_INVALID was used as a reference point
before in that case.

- - - - -


1 changed file:

- src/clock/input_clock.c


Changes:

=====================================
src/clock/input_clock.c
=====================================
@@ -339,15 +339,18 @@ void input_clock_Reset( input_clock_t *cl )
  *****************************************************************************/
 void input_clock_ChangeRate( input_clock_t *cl, float rate )
 {
+    float oldrate = cl->rate;
+    cl->rate = rate;
+
     if( cl->b_has_reference )
     {
         /* Move the reference point (as if we were playing at the new rate
          * from the start */
-        cl->ref.system = cl->last.system - (vlc_tick_t) ((cl->last.system - cl->ref.system) / rate * cl->rate);
-    }
-    cl->rate = rate;
+        cl->ref.system = cl->last.system
+            - (vlc_tick_t) ((cl->last.system - cl->ref.system) / rate * oldrate);
 
-    UpdateListener( cl, false );
+        UpdateListener( cl, false );
+    }
 }
 
 /*****************************************************************************



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bdd4ca716081abb5c4a54b33bf1c86af8cb6cbad...47da1c719b071e9bdf9ba2c8180ab1c471d653b2

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bdd4ca716081abb5c4a54b33bf1c86af8cb6cbad...47da1c719b071e9bdf9ba2c8180ab1c471d653b2
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list