[vlc-devel] [PATCH 1/3] demux: avformat: fix incorrect PCR

Zhao Zhili quinkblack at foxmail.com
Thu Aug 31 08:47:13 CEST 2017


If DTS of the first frame is invalid, then p_sys->tk_pcr[i] is invalid,
and the previous code will set PCR to INT64_MAX.
---
  modules/demux/avformat/demux.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index c46ecb5..3c4c112 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -820,7 +820,7 @@ static int Demux( demux_t *p_demux )
          if( p_sys->tk_pcr[i] > VLC_TS_INVALID && p_sys->tk_pcr[i] + 10 
* CLOCK_FREQ >= i_ts_max )
              i_ts_min = __MIN( i_ts_min, p_sys->tk_pcr[i] );
      }
-    if( i_ts_min >= p_sys->i_pcr )
+    if( i_ts_min >= p_sys->i_pcr && likely(i_ts_min != INT64_MAX) )
      {
          p_sys->i_pcr = i_ts_min;
          es_out_SetPCR( p_demux->out, p_sys->i_pcr );
-- 
2.7.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-demux-avformat-fix-incorrect-PCR.patch
Type: text/x-patch
Size: 1033 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170831/b6083eaa/attachment.bin>


More information about the vlc-devel mailing list