[vlc-devel] [PATCH 4/9] mkv: p_current_segment can change after a call to UpdateCurrentToChapter()

Steve Lhomme robux4 at videolabs.io
Tue Mar 15 15:45:57 CET 2016


---
 modules/demux/mkv/mkv.cpp | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 7d6979c..9e83ffb 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -713,13 +713,17 @@ static int Demux( demux_t *p_demux)
     vlc_mutex_locker( &p_sys->lock_demuxer );
 
     virtual_segment_c  *p_vsegment = p_sys->p_current_segment;
-    matroska_segment_c *p_segment = p_vsegment->CurrentSegment();
-    if ( p_segment == NULL )
-        return 0;
 
-    if( p_sys->i_pts >= p_sys->i_start_pts  )
+    if( p_sys->i_pts >= p_sys->i_start_pts )
+    {
         if ( p_vsegment->UpdateCurrentToChapter( *p_demux ) )
             return 1;
+        p_vsegment = p_sys->p_current_segment;
+    }
+
+    matroska_segment_c *p_segment = p_vsegment->CurrentSegment();
+    if ( p_segment == NULL )
+        return 0;
 
     KaxBlock *block;
     KaxSimpleBlock *simpleblock;
@@ -772,6 +776,7 @@ static int Demux( demux_t *p_demux)
             delete block;
             return 1;
         }
+        p_vsegment = p_sys->p_current_segment;
     }
 
     if ( p_vsegment->CurrentEdition() &&
-- 
2.7.2.windows.1



More information about the vlc-devel mailing list