[vlc-devel] [PATCH 3/5] demux/mkv: only convert duration if it has a proper value

Filip Roséen filip at atch.se
Sat Oct 22 04:54:10 CEST 2016


matroska_segment_c::i_duration defaults to having a value of "-1", and
we should of course not try to convert the duration from the unit
within an mkv to ours _unless_ we have initialized it (through the
value of a KaxDuration).

These changes fixes that.
---
 modules/demux/mkv/matroska_segment_parse.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index dcf201f..4eb0e7a 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -903,8 +903,8 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
 
     InfoHandlers::Dispatcher().iterate( m->begin(), m->end(), InfoHandlers::Payload( captures ) );
 
-    i_duration = mtime_t( static_cast<double>( i_duration * i_timescale ) / 10e5 );
-    if( !i_duration ) i_duration = -1;
+    if( i_duration != -1 )
+        i_duration = mtime_t( static_cast<double>( i_duration * i_timescale ) / 10e5 );
 }
 
 
-- 
2.10.0



More information about the vlc-devel mailing list