Commit fdd1eae5 authored by Denis Charmet's avatar Denis Charmet Committed by Jean-Baptiste Kempf

MKV: Avoid late picture drop when using many threads

Close #5953
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent f04179bd
......@@ -332,6 +332,7 @@ public:
demux_sys_t( demux_t & demux )
:demuxer(demux)
,i_pts(0)
,i_pcr(0)
,i_start_pts(0)
,i_chapter_time(0)
,meta(NULL)
......@@ -351,6 +352,7 @@ public:
demux_t & demuxer;
mtime_t i_pts;
mtime_t i_pcr;
mtime_t i_start_pts;
mtime_t i_chapter_time;
......
......@@ -725,11 +725,12 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
}
}
#ifdef WIN32
#ifndef WIN32
/* Don't try complex seek if we seek to 0 */
if( i_date == 0 )
{
es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, 0 );
es_out_Control( sys.demuxer.out, ES_OUT_SET_PCR, VLC_TS_0 );
es.I_O().setFilePointer( i_start_pos );
delete ep;
......@@ -737,6 +738,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
cluster = NULL;
sys.i_start_pts = 0;
sys.i_pts = 0;
sys.i_pcr = 0;
return;
}
#endif
......@@ -849,9 +851,11 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
if( p_last->i_date < p_min->i_date )
p_min = p_last;
sys.i_pts = p_min->i_date;
sys.i_pcr = sys.i_pts = p_min->i_date;
es_out_Control( sys.demuxer.out, ES_OUT_SET_PCR, VLC_TS_0 + sys.i_pcr );
cluster = (KaxCluster *) ep->UnGet( p_min->i_seek_pos, p_min->i_cluster_pos );
/* hack use BlockGet to get the cluster then goto the wanted block */
if ( !cluster )
{
......
......@@ -714,8 +714,11 @@ static int Demux( demux_t *p_demux)
p_sys->i_pts = p_sys->i_chapter_time + ( block->GlobalTimecode() / (mtime_t) 1000 );
/* The blocks are in coding order so we can safely consider that only references are in chronological order */
if( simpleblock == NULL || b_key_picture )
es_out_Control( p_demux->out, ES_OUT_SET_PCR, VLC_TS_0 + p_sys->i_pts );
if( p_sys->i_pts > p_sys->i_pcr + 300000 )
{
es_out_Control( p_demux->out, ES_OUT_SET_PCR, VLC_TS_0 + p_sys->i_pcr );
p_sys->i_pcr = p_sys->i_pts;
}
if( p_sys->i_pts >= p_sys->i_start_pts )
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment