[vlc-commits] demux/mkv: do not calculate duration for infinite clusters

Filip Roséen git at videolan.org
Wed Oct 26 16:30:07 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Sat Oct 22 04:54:11 2016 +0200| [f2756634ed3601fa7c00e974533f68fcbbb12d06] | committer: Thomas Guillem

demux/mkv: do not calculate duration for infinite clusters

It does not make sense trying to calculate the duration for something
for which there is no end, as such we should protect ourselves from
wasting our breath.

Signed-off-by: Steve Lhomme <robux4 at videolabs.io>
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 modules/demux/mkv/matroska_segment.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 3e0bb4e..f2557a0 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -686,7 +686,8 @@ bool matroska_segment_c::Preload( )
 
     b_preloaded = true;
 
-    EnsureDuration();
+    if( cluster == NULL || cluster->IsFiniteSize() )
+        EnsureDuration();
 
     return true;
 }
@@ -1026,6 +1027,12 @@ void matroska_segment_c::EnsureDuration()
             return;
         ParseCluster( p_last_cluster, false, SCOPE_PARTIAL_DATA );
 
+        if( p_last_cluster->IsFiniteSize() == false )
+        {
+            es.I_O().setFilePointer( i_current_position, seek_beginning );
+            return;
+        }
+
         // use the last block + duration
         uint64 i_last_timecode = p_last_cluster->GlobalTimecode();
         for( unsigned int i = 0; i < p_last_cluster->ListSize(); i++ )



More information about the vlc-commits mailing list