[vlc-commits] demux: ts: fix unset timestamp comparison
Francois Cartegnie
git at videolan.org
Thu Sep 6 18:09:19 CEST 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Sep 6 18:03:32 2018 +0200| [e750449d47c12dc840aa9a134bd65031bc1e0f51] | committer: Francois Cartegnie
demux: ts: fix unset timestamp comparison
regression by 178c1a4dfe72772085c5c5974f0cb792f702f192
refs #21125
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e750449d47c12dc840aa9a134bd65031bc1e0f51
---
modules/demux/mpeg/ts.c | 8 ++++----
modules/demux/mpeg/ts.h | 1 +
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index c396384d6e..8a9afe89be 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -926,7 +926,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
if( !p_sys->b_ignore_time_for_positions &&
p_pmt &&
- p_pmt->pcr.i_first > -1 && p_pmt->i_last_dts != VLC_TICK_INVALID &&
+ p_pmt->pcr.i_first > -1 && SETANDVALID(p_pmt->i_last_dts) &&
p_pmt->pcr.i_current > -1 )
{
double i_length = TimeStampWrapAround( p_pmt->pcr.i_first,
@@ -971,7 +971,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
}
if( !p_sys->b_ignore_time_for_positions && b_bool && p_pmt &&
- p_pmt->pcr.i_first > -1 && p_pmt->i_last_dts != VLC_TICK_INVALID &&
+ p_pmt->pcr.i_first > -1 && SETANDVALID(p_pmt->i_last_dts) &&
p_pmt->pcr.i_current > -1 )
{
stime_t i_length = TimeStampWrapAround( p_pmt->pcr.i_first,
@@ -1351,7 +1351,7 @@ static block_t * ConvertPESBlock( demux_t *p_demux, ts_es_t *p_es,
/* Teletext may have missing PTS (ETSI EN 300 472 Annexe A)
* In this case use the last PCR + 40ms */
stime_t i_pcr = p_es->p_program->pcr.i_current;
- if( i_pcr != VLC_TICK_INVALID )
+ if( SETANDVALID(i_pcr) )
p_block->i_pts = FROM_SCALE(i_pcr) + 40000;
}
}
@@ -1614,7 +1614,7 @@ static void ParsePESDataChain( demux_t *p_demux, ts_pid_t *pid, block_t *p_pes )
/* Compute PCR/DTS offset if any */
if( p_pmt->pcr.i_pcroffset == -1 && p_block->i_dts != VLC_TICK_INVALID &&
- p_pmt->pcr.i_current != VLC_TICK_INVALID &&
+ SETANDVALID(p_pmt->pcr.i_current) &&
(p_es->fmt.i_cat == VIDEO_ES || p_es->fmt.i_cat == AUDIO_ES) )
{
stime_t i_dts27 = TO_SCALE(p_block->i_dts);
diff --git a/modules/demux/mpeg/ts.h b/modules/demux/mpeg/ts.h
index a867db5686..d9b6a08254 100644
--- a/modules/demux/mpeg/ts.h
+++ b/modules/demux/mpeg/ts.h
@@ -28,6 +28,7 @@ typedef struct csa_t csa_t;
#define TS_USER_PMT_NUMBER (0)
#define TS_PSI_PAT_PID 0x00
+#define SETANDVALID(a) (a != -1 && a != VLC_TICK_INVALID)
typedef enum ts_standards_e
{
More information about the vlc-commits
mailing list