[vlc-commits] demux:mkv: don't add seekpoints for tracks that don't exist

Steve Lhomme git at videolan.org
Wed Aug 2 17:54:50 CEST 2017


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Wed Aug  2 17:06:57 2017 +0200| [b59d5c3b5b6546845452d4f9163f176a4da472b5] | committer: Jean-Baptiste Kempf

demux:mkv: don't add seekpoints for tracks that don't exist

Fixes #18596

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

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

 modules/demux/mkv/matroska_segment.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 982792d347..6baac941c2 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -1204,7 +1204,10 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
 
             if( ksblock.IsKeyframe() )
             {
-                vars.obj->_seeker.add_seekpoint( ksblock.TrackNum(), SegmentSeeker::Seekpoint::TRUSTED, ksblock.GetElementPosition(), ksblock.GlobalTimecode() / 1000 );
+                tracks_map_t::iterator track_it;
+                bool const b_valid_track = !vars.obj->FindTrackByBlock( &track_it, NULL, &ksblock );
+                if (b_valid_track)
+                    vars.obj->_seeker.add_seekpoint( ksblock.TrackNum(), SegmentSeeker::Seekpoint::TRUSTED, ksblock.GetElementPosition(), ksblock.GlobalTimecode() / 1000 );
             }
         }
     };
@@ -1219,7 +1222,9 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
             vars.block->ReadData( vars.obj->es.I_O() );
             vars.block->SetParent( *vars.obj->cluster );
 
-            if( vars.obj->tracks.at( kblock.TrackNum() )->fmt.i_cat == SPU_ES )
+            tracks_map_t::iterator track_it;
+            bool const b_valid_track = !vars.obj->FindTrackByBlock( &track_it, &kblock, NULL );
+            if( b_valid_track && track_it->second->fmt.i_cat == SPU_ES )
             {
                 vars.obj->_seeker.add_seekpoint( kblock.TrackNum(), SegmentSeeker::Seekpoint::TRUSTED, kblock.GetElementPosition(), kblock.GlobalTimecode() / 1000 );
             }



More information about the vlc-commits mailing list