[vlc-commits] demux/mkv: abort matroska_segment_c::PreloadClusters on end-of-file

Filip Roséen git at videolan.org
Tue Feb 21 13:44:13 CET 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Mon Feb 20 18:10:19 2017 +0100| [172789c5ec8236b3b4065cb24e8d19c37fbc8733] | committer: Jean-Baptiste Kempf

demux/mkv: abort matroska_segment_c::PreloadClusters on end-of-file

The previous implementation assumed that every mkv had at least one
non-Cluster element following the Clusters; meaning that it would
potentially try to continue parsing even though the parser reached a
state where no more elements can be read at the current level.

We should of course stop the affected loop if no more elements can be
read, as these changes make sure we do.

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

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

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

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 016748b..9aca1da 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -509,8 +509,12 @@ bool matroska_segment_c::PreloadClusters(uint64 i_cluster_pos)
         while (payload.stop_parsing == false)
         {
             EbmlParser parser ( &es, segment, &sys.demuxer, var_InheritBool( &sys.demuxer, "mkv-use-dummy" ) );
+            EbmlElement* el = parser.Get();
 
-            ClusterHandler::Dispatcher().send( parser.Get(), ClusterHandler::Payload( payload ) );
+            if( el == NULL )
+                break;
+
+            ClusterHandler::Dispatcher().send( el, ClusterHandler::Payload( payload ) );
         }
     }
 



More information about the vlc-commits mailing list