[vlc-commits] [Git][videolan/vlc][master] 10 commits: demux: ts: fix bogus vlc_tick_t conversion

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed May 21 07:19:42 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
086758c8 by Steve Lhomme at 2025-05-21T06:45:25+00:00
demux: ts: fix bogus vlc_tick_t conversion

p_pmt->pcr.i_first_dts and p_block->i_dts are both vlc_tick_t.

Introduced in 68fcf13842229e17c3db26ed62f457219484ff77.

- - - - -
cd5a4352 by Steve Lhomme at 2025-05-21T06:45:25+00:00
demux: ts: use proper invalid ts_90khz_t value

- - - - -
e3adccef by Steve Lhomme at 2025-05-21T06:45:25+00:00
demux: scte: fix bogus vlc_tick_t conversion

Originally introduced in 7e3dcdd09c2fac64f00acb360d30f24c74894609.

- - - - -
29c1ee07 by Steve Lhomme at 2025-05-21T06:45:25+00:00
demux: ts: fix mismatched substraction timestamp types

i_dts is a ts_90khz_t and the other values are vlc_tick_t.

i_first_dts is already set to FROM_SCALE(i_dts) a few lines above.

- - - - -
70942381 by Steve Lhomme at 2025-05-21T06:45:25+00:00
demux: ts: fix comparison between vlc_tick_t and TS_90KHZ_INVALID

- - - - -
e96ebb7d by Steve Lhomme at 2025-05-21T06:45:25+00:00
demux: ts: fix check against TS_90KHZ_INVALID

The TS_90KHZ_INVALID should not be any particular value.
We can only check if it's equal or not.

- - - - -
6a8fef1d by Steve Lhomme at 2025-05-21T06:45:25+00:00
demux: ts: fix mismatched comparison timestamp types

i_first_dts is a vlc_tick_t as seen a few lines above.

- - - - -
75d937a3 by Steve Lhomme at 2025-05-21T06:45:25+00:00
mux: ts: use ts_90khz_t for TO_SCALE_NZ variables.

- - - - -
ac24fc13 by Steve Lhomme at 2025-05-21T06:45:25+00:00
mux: ps: use ts_90khz_t for TO_SCALE_NZ variables.

- - - - -
e1b11446 by Steve Lhomme at 2025-05-21T06:45:25+00:00
mux: pes: use ts_90khz_t for TO_SCALE_NZ variables.

- - - - -


7 changed files:

- modules/demux/mpeg/ts.c
- modules/demux/mpeg/ts_hotfixes.c
- modules/demux/mpeg/ts_pes.c
- modules/demux/mpeg/ts_scte.c
- modules/mux/mpeg/pes.c
- modules/mux/mpeg/ps.c
- modules/mux/mpeg/ts.c


Changes:

=====================================
modules/demux/mpeg/ts.c
=====================================
@@ -1659,7 +1659,7 @@ static void ParsePESDataChain( demux_t *p_demux, ts_pid_t *pid, block_t *p_pes,
     if( i_pts != VLC_TICK_INVALID && i_dts == VLC_TICK_INVALID )
         i_dts = i_pts;
 
-    if( i_dts != TS_90KHZ_INVALID )
+    if( i_dts != VLC_TICK_INVALID )
         pid->u.p_stream->i_last_dts = i_dts;
 
     if( p_pes )
@@ -2399,7 +2399,7 @@ static void PCRCheckDTS( demux_t *p_demux, ts_pmt_t *p_pmt, vlc_tick_t i_pcr)
 
         if( i_pktdts != TS_90KHZ_INVALID )
             i_dts = TimeStampWrapAround( i_pcr, FROM_SCALE(i_pktdts) );
-        if( i_pktpts > TS_90KHZ_INVALID )
+        if( i_pktpts != TS_90KHZ_INVALID )
             i_pts = TimeStampWrapAround( i_pcr, FROM_SCALE(i_pktpts) );
 
         if (p_pmt->pcr.i_pcroffset > 0) {
@@ -2527,9 +2527,9 @@ static void PCRFixHandle( demux_t *p_demux, ts_pmt_t *p_pmt, block_t *p_block )
     /* Record the first data packet timestamp in case there won't be any PCR */
     else if( p_pmt->pcr.i_first_dts == VLC_TICK_INVALID )
     {
-        p_pmt->pcr.i_first_dts = TO_SCALE(p_block->i_dts);
+        p_pmt->pcr.i_first_dts = p_block->i_dts;
     }
-    else if( p_block->i_dts - FROM_SCALE(p_pmt->pcr.i_first_dts) > VLC_TICK_FROM_MS(500) ) /* "PCR repeat rate shall not exceed 100ms" */
+    else if( p_block->i_dts - p_pmt->pcr.i_first_dts > VLC_TICK_FROM_MS(500) ) /* "PCR repeat rate shall not exceed 100ms" */
     {
         if( p_pmt->pcr.i_current == VLC_TICK_INVALID &&
             GetPID( p_sys, p_pmt->i_pid_pcr )->probed.i_pcr_count == 0 )


=====================================
modules/demux/mpeg/ts_hotfixes.c
=====================================
@@ -205,7 +205,7 @@ codecprobingend:
     else if( p_sys->patfix.i_timesourcepid == pid->i_pid && i_dts != TS_90KHZ_INVALID &&
              p_sys->patfix.status == PAT_WAITING )
     {
-        if( i_dts - p_sys->patfix.i_first_dts > MIN_PAT_INTERVAL )
+        if( FROM_SCALE(i_dts) - p_sys->patfix.i_first_dts > MIN_PAT_INTERVAL )
             p_sys->patfix.status = PAT_MISSING;
     }
 


=====================================
modules/demux/mpeg/ts_pes.c
=====================================
@@ -161,7 +161,7 @@ static bool ts_pes_Push( ts_pes_parse_callback *cb,
 
 bool ts_pes_Drain( ts_pes_parse_callback *cb, ts_stream_t *p_pes )
 {
-    return ts_pes_Push( cb, p_pes, NULL, true, VLC_TICK_INVALID );
+    return ts_pes_Push( cb, p_pes, NULL, true, TS_90KHZ_INVALID );
 }
 
 bool ts_pes_Gather( ts_pes_parse_callback *cb,


=====================================
modules/demux/mpeg/ts_scte.c
=====================================
@@ -110,7 +110,7 @@ void SCTE27_Section_Callback( demux_t *p_demux,
 
     }
 
-    p_content->i_dts = p_content->i_pts = FROM_SCALE(i_date);
+    p_content->i_dts = p_content->i_pts = i_date;
     //PCRFixHandle( p_demux, p_pmt, p_content );
 
     if( p_pes->p_es->id )


=====================================
modules/mux/mpeg/pes.c
=====================================
@@ -52,7 +52,7 @@
  * \param i_header_size length of padding data to insert into PES packet
  *                      header in bytes.
  */
-static inline int PESHeader( uint8_t *p_hdr, int64_t i_pts, int64_t i_dts,
+static inline int PESHeader( uint8_t *p_hdr, ts_90khz_t i_pts, ts_90khz_t i_dts,
                              int i_es_size, const es_format_t *p_fmt,
                              int i_stream_id, bool b_mpeg2,
                              bool b_data_alignment, int i_header_size )
@@ -356,8 +356,8 @@ void EStoPES ( block_t **pp_pes,
     if( !p_es )
         return;
 
-    int64_t i_dts = 0;
-    int64_t i_pts = 0;
+    ts_90khz_t i_dts = 0;
+    ts_90khz_t i_pts = 0;
     if (p_es->i_pts != VLC_TICK_INVALID)
         i_pts = TO_SCALE_NZ(p_es->i_pts - ts_offset);
     if (p_es->i_dts != VLC_TICK_INVALID)


=====================================
modules/mux/mpeg/ps.c
=====================================
@@ -594,7 +594,7 @@ static void MuxWritePackHeader( sout_mux_t *p_mux, block_t **p_buf,
     sout_mux_sys_t *p_sys = p_mux->p_sys;
     bits_buffer_t bits;
     block_t *p_hdr;
-    int64_t i_scr;
+    ts_90khz_t i_scr;
     int i_mux_rate;
 
     i_scr = TO_SCALE_NZ(i_dts - p_sys->i_dts_delay);


=====================================
modules/mux/mpeg/ts.c
=====================================
@@ -1875,7 +1875,7 @@ static block_t *TSNew( sout_mux_t *p_mux, sout_input_sys_t *p_stream,
 
 static void TSSetPCR( block_t *p_ts, vlc_tick_t i_dts )
 {
-    int64_t i_pcr = TO_SCALE_NZ(i_dts);
+    ts_90khz_t i_pcr = TO_SCALE_NZ(i_dts);
 
     p_ts->p_buffer[6]  = ( i_pcr >> 25 )&0xff;
     p_ts->p_buffer[7]  = ( i_pcr >> 17 )&0xff;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/35396660acf211bc481dffb3e2225072a738ea41...e1b1144633e2d22ffff4b11e2ab599e68e62a38a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/35396660acf211bc481dffb3e2225072a738ea41...e1b1144633e2d22ffff4b11e2ab599e68e62a38a
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