mkv: abort seek completely if it fails
authorFilip Roséen <filip@videolabs.io>
Fri, 13 May 2016 13:34:43 +0000 (15:34 +0200)
committerThomas Guillem <thomas@gllm.fr>
Fri, 13 May 2016 13:41:38 +0000 (15:41 +0200)
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
modules/demux/mkv/matroska_segment.cpp
modules/demux/mkv/matroska_segment_seeker.cpp
modules/demux/mkv/mkv.hpp

index ac5af66..07c431e 100644 (file)
@@ -807,7 +807,17 @@ void matroska_segment_c::Seek( mtime_t i_absolute_mk_date, mtime_t i_mk_time_off
 
     mtime_t i_mk_date = i_absolute_mk_date - i_mk_time_offset;
 
-    SegmentSeeker::tracks_seekpoint_t seekpoints = _seeker.get_seekpoints_cues( *this, i_mk_date );
+    SegmentSeeker::tracks_seekpoint_t seekpoints;
+
+    try {
+        seekpoints = _seeker.get_seekpoints_cues( *this, i_mk_date );
+
+    }
+    catch( std::exception const& e )
+    {
+        msg_Err( &sys.demuxer, "error during seek: \"%s\", aborting!", e.what() );
+        return;
+    }
 
     for( SegmentSeeker::tracks_seekpoint_t::iterator it = seekpoints.begin(); it != seekpoints.end(); ++it )
     {
index 49750a1..8ae1a4a 100644 (file)
@@ -283,8 +283,7 @@ SegmentSeeker::index_unsearched_range( matroska_segment_c& ms, Range search_area
 
         if( ms.BlockGet( block, simpleblock, &b_key_picture, &b_discardable_picture, &i_block_duration ) )
         {
-            msg_Err( &ms.sys.demuxer, "Unable to BlockGet in matroska_segment_c::Seek, EOF?" );
-            return;
+            throw std::runtime_error( "Unable to BlockGet in SegmentSeeker::index_unsearched_range, EOF?" );
         }
 
         if( simpleblock ) {
index 8bad7dc..6bbca6b 100644 (file)
@@ -53,6 +53,7 @@
 #include <vector>
 #include <algorithm>
 #include <map>
+#include <stdexcept>
 
 /* libebml and matroska */
 #include "ebml/EbmlHead.h"