[vlc-commits] [Git][videolan/vlc][3.0.x] 7 commits: demux: ts: fix bogus vlc_tick_t conversion

François Cartegnie (@fcartegnie) gitlab at videolan.org
Fri May 23 05:05:35 UTC 2025



François Cartegnie pushed to branch 3.0.x at VideoLAN / VLC


Commits:
7f7aad34 by Steve Lhomme at 2025-05-23T04:47:50+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.

(cherry picked from commit 086758c8c60f6b36b393a94c7f22400a66368bf3)

- - - - -
46637794 by Steve Lhomme at 2025-05-23T04:47:50+00:00
demux: ts: use proper invalid ts_90khz_t value

(cherry picked from commit cd5a435254f1586e671aff9603397cda9222de69)

- - - - -
1f037b17 by Steve Lhomme at 2025-05-23T04:47:50+00:00
demux: scte: fix bogus vlc_tick_t conversion

Originally introduced in 7e3dcdd09c2fac64f00acb360d30f24c74894609.

(cherry picked from commit e3adccef03cd3c477cc59628d0ca998e12da0769) (edited)
edited:
- 3.0 did not use FROM_SCALE

- - - - -
91bd0660 by Steve Lhomme at 2025-05-23T04:47:50+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.

(cherry picked from commit 29c1ee07a8b7825cdc46494bf17690c374001358)

- - - - -
f1a8be10 by Steve Lhomme at 2025-05-23T04:47:50+00:00
demux: ts: fix comparison between vlc_tick_t and TS_90KHZ_INVALID

(cherry picked from commit 70942381f759c66f887c081ddf6f5bd789b2dc3c)

- - - - -
37ec4b60 by Steve Lhomme at 2025-05-23T04:47:50+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.

(cherry picked from commit e96ebb7dfe1c57de73a37f7e94f2642076896a43)

- - - - -
6360e4f5 by Steve Lhomme at 2025-05-23T04:47:50+00:00
demux: ts: fix mismatched comparison timestamp types

i_first_dts is a vlc_tick_t as seen a few lines above.

(cherry picked from commit 6a8fef1d1ffb336760ce817540887816fe63106c) (edited)
- 4.0 used VLC_TICK_FROM_MS(500) instead of CLOCK_FREQ / 2

- - - - -


4 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


Changes:

=====================================
modules/demux/mpeg/ts.c
=====================================
@@ -1594,7 +1594,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 )
@@ -2288,7 +2288,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) {
@@ -2416,9 +2416,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) > CLOCK_FREQ / 2 ) /* "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_demux->p_sys, p_pmt->i_pid_pcr )->probed.i_pcr_count == 0 )


=====================================
modules/demux/mpeg/ts_hotfixes.c
=====================================
@@ -200,7 +200,7 @@ void ProbePES( demux_t *p_demux, ts_pid_t *pid, const uint8_t *p_pesstart, size_
     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
=====================================
@@ -149,7 +149,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 = VLC_TICK_0 + i_date * 100 / 9;
+    p_content->i_dts = p_content->i_pts = i_date;
     //PCRFixHandle( p_demux, p_pmt, p_content );
 
     if( p_pes->p_es->id )



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/02013c329df488df030788e03673fcd5b966d0d4...6360e4f5f7ab0128a1563ffa717f32d5b7692582

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/02013c329df488df030788e03673fcd5b966d0d4...6360e4f5f7ab0128a1563ffa717f32d5b7692582
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