[vlc-commits] [Git][videolan/vlc][master] 2 commits: input: don't override NPT with invalid values

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Sep 18 06:21:27 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
53fbd402 by Thomas Guillem at 2024-09-18T06:02:32+00:00
input: don't override NPT with invalid values

After a seek, the demux module can fail to get the NPT. Don't fallback
to TICK_0 in that case, but use the previous value.

Fixes #25816

- - - - -
44486475 by Thomas Guillem at 2024-09-18T06:02:32+00:00
player: timer: always send update when forced

This fixes npt or length not being updated in time by timer clients
since the input source is not likely the best_source.

- - - - -


4 changed files:

- src/input/es_out.c
- src/input/input.c
- src/player/input.c
- src/player/timer.c


Changes:

=====================================
src/input/es_out.c
=====================================
@@ -3846,7 +3846,8 @@ static int EsOutVaPrivControlLocked(es_out_sys_t *p_sys, input_source_t *source,
         vlc_tick_t i_normal_time = va_arg( args, vlc_tick_t );
         vlc_tick_t i_length = va_arg( args, vlc_tick_t );
 
-        source->i_normal_time = i_normal_time;
+        if (i_normal_time != VLC_TICK_INVALID)
+            source->i_normal_time = i_normal_time;
 
         if( source != p_sys->main_source )
             return VLC_SUCCESS;
@@ -3879,8 +3880,6 @@ static int EsOutVaPrivControlLocked(es_out_sys_t *p_sys, input_source_t *source,
         if (f_position < 0)
             f_position = 0;
 
-        assert(i_normal_time >= VLC_TICK_0);
-
         input_SendEventTimes(p_sys->p_input, f_position, i_time,
                              i_normal_time, i_length);
         return VLC_SUCCESS;


=====================================
src/input/input.c
=====================================
@@ -592,9 +592,9 @@ static void InputSourceStatistics(input_source_t *source, input_item_t *item,
 
     i_length = InputSourceGetLength( source, item );
 
-    /* In case of failure (not implemented or in case of seek), use VLC_TICK_0. */
+    /* In case of failure (not implemented or in case of seek), use VLC_TICK_INVALID. */
     if (demux_Control( source->p_demux, DEMUX_GET_NORMAL_TIME, &i_normal_time ) != VLC_SUCCESS)
-        i_normal_time = VLC_TICK_0;
+        i_normal_time = VLC_TICK_INVALID;
 
     es_out_SetTimes( out, f_position, i_time, i_normal_time, i_length );
 }
@@ -3506,4 +3506,4 @@ vlc_tick_t input_GetItemDuration(input_thread_t *input, vlc_tick_t duration)
         duration = priv->i_stop - priv->i_start;
 
     return duration;
-}
\ No newline at end of file
+}


=====================================
src/player/input.c
=====================================
@@ -942,7 +942,6 @@ input_thread_Events(input_thread_t *input_thread,
 
             if (input->normal_time != event->times.normal_time)
             {
-                assert(event->times.normal_time != VLC_TICK_INVALID);
                 input->normal_time = event->times.normal_time;
                 changed = true;
             }


=====================================
src/player/timer.c
=====================================
@@ -358,7 +358,7 @@ vlc_player_UpdateTimerBestSource(vlc_player_t *player, vlc_es_id_t *es_source,
         source->es = es_source;
 
     /* Notify the best source */
-    if (source->es == es_source)
+    if (source->es == es_source || force_update)
     {
         if (source->point.rate != point->rate)
         {
@@ -448,7 +448,8 @@ vlc_player_UpdateTimer(vlc_player_t *player, vlc_es_id_t *es_source,
     if (!es_source) /* input source */
     {
         /* Only valid for input sources */
-        if (player->timer.input_normal_time != normal_time)
+        if (normal_time != VLC_TICK_INVALID
+         && player->timer.input_normal_time != normal_time)
         {
             player->timer.input_normal_time = normal_time;
             player->timer.last_ts = VLC_TICK_INVALID;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b5e27edcd186f7d64f3013e1807de974d33de016...44486475911067b6ac6c07a5559577c514bd9788

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b5e27edcd186f7d64f3013e1807de974d33de016...44486475911067b6ac6c07a5559577c514bd9788
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