[vlc-devel] [PATCH] demux: avformat: do not take account of invalid streams for PCR updating

Zhao Zhili wantlamy at gmail.com
Mon Mar 20 16:56:57 CET 2017


---
 modules/demux/avformat/demux.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 4824215..48ba7f8 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -834,17 +834,22 @@ static int Demux( demux_t *p_demux )
     msg_Dbg( p_demux, "tk[%d] dts=%"PRId64" pts=%"PRId64,
              pkt.stream_index, p_frame->i_dts, p_frame->i_pts );
 #endif
-    if( p_frame->i_dts > VLC_TS_INVALID )
+    if( p_frame->i_dts > VLC_TS_INVALID && p_sys->tk[pkt.stream_index] != NULL )
         p_sys->tk_pcr[pkt.stream_index] = p_frame->i_dts;
 
     int64_t i_ts_max = INT64_MIN;
     for( int i = 0; i < p_sys->i_tk; i++ )
-        i_ts_max = __MAX( i_ts_max, p_sys->tk_pcr[i] );
+    {
+        if( p_sys->tk[i] != NULL )
+            i_ts_max = __MAX( i_ts_max, p_sys->tk_pcr[i] );
+    }
 
     int64_t i_ts_min = INT64_MAX;
     for( int i = 0; i < p_sys->i_tk; i++ )
     {
-        if( p_sys->tk_pcr[i] > VLC_TS_INVALID && p_sys->tk_pcr[i] + 10 * CLOCK_FREQ >= i_ts_max )
+        if( p_sys->tk[i] != NULL &&
+                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 )
-- 
2.10.1 (Apple Git-78)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-demux-avformat-do-not-take-account-of-invalid-stream.patch
Type: application/octet-stream
Size: 1623 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170320/c62ed3e8/attachment.obj>


More information about the vlc-devel mailing list