[vlc-devel] [PATCH 07/17] demux: ts: refactor

Thomas Guillem thomas at gllm.fr
Tue Mar 9 15:15:36 UTC 2021


Handle i_last_dts calculation before sending the PCR, it will be used
for the next commit.

No functional changes.
---
 modules/demux/mpeg/ts.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 52319fd220c..30dd177ecdc 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -2267,19 +2267,22 @@ static void ProgramSetPCR( demux_t *p_demux, ts_pmt_t *p_pmt, stime_t i_pcr )
 
     if ( p_sys->i_pmt_es )
     {
-        es_out_Control( p_demux->out, ES_OUT_SET_GROUP_PCR, p_pmt->i_number, FROM_SCALE(i_pcr), VLC_TICK_INVALID );
-        /* growing files/named fifo handling */
-        if( p_sys->b_access_control == false &&
-            vlc_stream_Tell( p_sys->stream ) > p_pmt->i_last_dts_byte )
+        if( p_sys->b_access_control == false )
         {
-            if( p_pmt->i_last_dts_byte == 0 ) /* first run */
-                p_pmt->i_last_dts_byte = stream_Size( p_sys->stream );
-            else
+            /* growing files/named fifo handling */
+            if( vlc_stream_Tell( p_sys->stream ) > p_pmt->i_last_dts_byte )
             {
-                p_pmt->i_last_dts = i_pcr;
-                p_pmt->i_last_dts_byte = vlc_stream_Tell( p_sys->stream );
+                if( p_pmt->i_last_dts_byte == 0 ) /* first run */
+                    p_pmt->i_last_dts_byte = stream_Size( p_sys->stream );
+                else
+                {
+                    p_pmt->i_last_dts = i_pcr;
+                    p_pmt->i_last_dts_byte = vlc_stream_Tell( p_sys->stream );
+                }
             }
         }
+
+        es_out_Control( p_demux->out, ES_OUT_SET_GROUP_PCR, p_pmt->i_number, FROM_SCALE(i_pcr), VLC_TICK_INVALID );
     }
 }
 
-- 
2.30.0



More information about the vlc-devel mailing list