[vlc-commits] demux:ps: init the first_pts to VLC_TICK_INVALID

Steve Lhomme git at videolan.org
Tue Sep 18 09:43:48 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon May  7 10:33:31 2018 +0200| [19fb3b1e6a09fd856dbab6d5aee8281a3d93a94d] | committer: Steve Lhomme

demux:ps: init the first_pts to VLC_TICK_INVALID

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=19fb3b1e6a09fd856dbab6d5aee8281a3d93a94d
---

 modules/demux/mpeg/ps.c | 6 +++---
 modules/demux/mpeg/ps.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/demux/mpeg/ps.c b/modules/demux/mpeg/ps.c
index 42f88582c7..b00097c383 100644
--- a/modules/demux/mpeg/ps.c
+++ b/modules/demux/mpeg/ps.c
@@ -314,7 +314,7 @@ static int Probe( demux_t *p_demux, bool b_end )
             {
                 tk->i_last_pts = p_pkt->i_pts;
             }
-            else if ( tk->i_first_pts == -1 )
+            else if ( tk->i_first_pts == VLC_TICK_INVALID )
             {
                 tk->i_first_pts = p_pkt->i_pts;
             }
@@ -369,10 +369,10 @@ static bool FindLength( demux_t *p_demux )
     for( int i = 0; i < PS_TK_COUNT; i++ )
     {
         ps_track_t *tk = &p_sys->tk[i];
-        if( tk->i_first_pts >= 0 &&
+        if( tk->i_first_pts != VLC_TICK_INVALID &&
             tk->i_last_pts > tk->i_first_pts )
         {
-            int64_t i_length = (int64_t)tk->i_last_pts - tk->i_first_pts;
+            vlc_tick_t i_length = tk->i_last_pts - tk->i_first_pts;
             if( i_length > p_sys->i_length )
             {
                 p_sys->i_length = i_length;
diff --git a/modules/demux/mpeg/ps.h b/modules/demux/mpeg/ps.h
index 0d9d30ae6f..904c5ef8fa 100644
--- a/modules/demux/mpeg/ps.h
+++ b/modules/demux/mpeg/ps.h
@@ -78,7 +78,7 @@ static inline void ps_track_init( ps_track_t tk[PS_TK_COUNT] )
         tk[i].i_id   = 0;
         tk[i].i_next_block_flags = 0;
         tk[i].es     = NULL;
-        tk[i].i_first_pts = -1;
+        tk[i].i_first_pts = VLC_TICK_INVALID;
         tk[i].i_last_pts = -1;
         es_format_Init( &tk[i].fmt, UNKNOWN_ES, 0 );
     }



More information about the vlc-commits mailing list