[vlc-commits] [Git][videolan/vlc][master] input: report the main source origin before sending slave blocks

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Fri Nov 27 12:09:23 UTC 2026



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
c94e84de by Abubakar Mahmood at 2026-11-27T12:48:16+01:00
input: report the main source origin before sending slave blocks

The first external subtitle block can reach the output before the periodic
timing update has delivered the MPEG-TS origin. It then receives the
wrong shift and its cue can end early or disappear.

Report a changed, valid normal time through the existing timing update
once the main demuxer supplies a playback time and before demuxing
slaves. Track the last reported origin on the input thread because
timeshift can apply the update later.

- - - - -


2 changed files:

- src/input/input.c
- src/input/source.h


Changes:

=====================================
src/input/input.c
=====================================
@@ -612,6 +612,8 @@ static void InputSourceStatistics(input_source_t *source, input_item_t *item,
 
     es_out_SetTimes( out, f_position, i_time, i_normal_time, i_length,
                      live );
+    if (i_normal_time != VLC_TICK_INVALID)
+        source->reported_normal_time = i_normal_time;
 }
 
 /**
@@ -2839,6 +2841,7 @@ static input_source_t *InputSourceNew( const char *psz_mrl )
     }
 
     in->i_normal_time = VLC_TICK_0;
+    in->reported_normal_time = VLC_TICK_INVALID;
 
     return in;
 }
@@ -3128,12 +3131,20 @@ static void SlaveDemux( input_thread_t *p_input )
     input_thread_private_t *priv = input_priv(p_input);
     vlc_tick_t i_time;
 
-    if( demux_Control( input_priv(p_input)->master->p_demux, DEMUX_GET_TIME, &i_time ) )
+    if( demux_Control( priv->master->p_demux, DEMUX_GET_TIME, &i_time ) )
     {
         msg_Err( p_input, "demux doesn't like DEMUX_GET_TIME" );
         return;
     }
 
+    /* Report a changed main origin before the slaves send blocks that use it. */
+    vlc_tick_t normal_time;
+    if( demux_Control( priv->master->p_demux, DEMUX_GET_NORMAL_TIME,
+                       &normal_time ) == VLC_SUCCESS
+     && normal_time != VLC_TICK_INVALID
+     && normal_time != priv->master->reported_normal_time )
+        InputSourceStatistics( priv->master, priv->p_item, priv->p_es_out );
+
     for (size_t i = 0; i < input_priv(p_input)->i_slave; i++)
     {
         input_source_t *in = input_priv(p_input)->slave[i];


=====================================
src/input/source.h
=====================================
@@ -74,6 +74,9 @@ struct input_source_t
     /* Read-write protected by es_out.c lock */
     vlc_tick_t i_normal_time;
 
+    /* Last valid normal time reported by the input thread. */
+    vlc_tick_t reported_normal_time;
+
     bool       b_eof;   /* eof of demuxer */
 };
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c94e84def7f4243802c564efdc9298ee69a9e0d5

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c94e84def7f4243802c564efdc9298ee69a9e0d5
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list