[vlc-devel] [PATCH 4/5] demux/mkv: do not calculate duration for infinite clusters
Filip Roséen
filip at atch.se
Sat Oct 22 04:54:11 CEST 2016
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.
---
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++ )
--
2.10.0
More information about the vlc-devel
mailing list