[vlc-devel] [PATCH v3 5/6] input_clock: a valid cbs struct is now mandatory

Thomas Guillem thomas at gllm.fr
Fri Mar 12 16:08:20 UTC 2021


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

diff --git a/src/clock/input_clock.c b/src/clock/input_clock.c
index 45edf26dfcf..0be83e1568e 100644
--- a/src/clock/input_clock.c
+++ b/src/clock/input_clock.c
@@ -155,6 +155,7 @@ input_clock_t *input_clock_New( float rate, const struct input_clock_cbs *cbs,
     if( !cl )
         return NULL;
 
+    assert(cbs != NULL && cbs->on_drift_update != NULL);
     cl->cbs = cbs;
     cl->cbs_data = cbs_data;
     cl->b_has_reference = false;
@@ -227,8 +228,7 @@ vlc_tick_t input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
     {
         cl->i_next_drift_update = VLC_TICK_INVALID;
         AvgReset( &cl->drift );
-        if (cl->cbs != NULL)
-            cl->cbs->on_drift_update( 0, cl->cbs_data );
+        cl->cbs->on_drift_update( 0, cl->cbs_data );
 
         /* Feed synchro with a new reference point. */
         cl->b_has_reference = true;
@@ -244,8 +244,7 @@ vlc_tick_t input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
         const vlc_tick_t i_converted = ClockSystemToStream( cl, i_ck_system );
 
         AvgUpdate( &cl->drift, i_converted - i_ck_stream );
-        if (cl->cbs != NULL)
-            cl->cbs->on_drift_update( AvgGet( &cl->drift ), cl->cbs_data );
+        cl->cbs->on_drift_update( AvgGet( &cl->drift ), cl->cbs_data );
 
         cl->i_next_drift_update = i_ck_system + VLC_TICK_FROM_MS(200); /* FIXME why that */
     }
-- 
2.30.0



More information about the vlc-devel mailing list