[vlc-commits] MKV: Avoid late picture drop when using many threads

Denis Charmet git at videolan.org
Fri Feb 17 00:57:26 CET 2012


vlc/vlc-2.0 | branch: master | Denis Charmet <typx at dinauz.org> | Thu Feb 16 22:42:14 2012 +0100| [ef8bdea57f523bbfab513c81f2fbe445d886f63e] | committer: Jean-Baptiste Kempf

MKV: Avoid late picture drop when using many threads

Close #5953

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit fdd1eae579d1847952bcbd5bb2c60b8f46c9204c)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/demux/mkv/demux.hpp            |    2 ++
 modules/demux/mkv/matroska_segment.cpp |    8 ++++++--
 modules/demux/mkv/mkv.cpp              |    7 +++++--
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/modules/demux/mkv/demux.hpp b/modules/demux/mkv/demux.hpp
index db72f5d..ce7c966 100644
--- a/modules/demux/mkv/demux.hpp
+++ b/modules/demux/mkv/demux.hpp
@@ -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;
 
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 749faaf..c0a0d03 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -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 )
     {
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index eedeba1..7be24c8 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -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  )
         {



More information about the vlc-commits mailing list