[vlc-devel] [PATCH] Handle MKV segment change properly

Denis Charmet typx at dinauz.org
Thu Feb 2 01:42:54 CET 2012


Don't use the var_SetTime hack anymore and don't flush the fifo when
it's not necessary.
Fix #5967 and #2855
---
 modules/demux/mkv/mkv.cpp             |    5 ++---
 modules/demux/mkv/virtual_segment.cpp |    4 +---
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 104cac8..eedeba1 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -668,7 +668,7 @@ static int Demux( demux_t *p_demux)
         if( p_sys->i_pts >= p_sys->i_start_pts  )
             if ( p_vsegment->UpdateCurrentToChapter( *p_demux ) )
             {
-                i_return = ( i_block_count != 0 );
+                i_return = 1;
                 break;
             }
 
@@ -694,7 +694,7 @@ static int Demux( demux_t *p_demux)
                     /* TODO handle successive chapters with the same user_start_time/user_end_time
                     */
                     p_sys->i_pts = p_chap->i_virtual_stop_time;
-                    p_sys->i_start_pts =  p_sys->i_pts++; // trick to avoid staying on segments with no duration and no content
+                    p_sys->i_pts++; // trick to avoid staying on segments with no duration and no content
 
                     i_return = 1;
                 }
@@ -704,7 +704,6 @@ static int Demux( demux_t *p_demux)
             else
             {
                 msg_Warn( p_demux, "cannot get block EOF?" );
-                es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
                 break;
             }
         }
diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp
index 0f667f2..378aaae 100644
--- a/modules/demux/mkv/virtual_segment.cpp
+++ b/modules/demux/mkv/virtual_segment.cpp
@@ -386,8 +386,7 @@ bool virtual_segment_c::UpdateCurrentToChapter( demux_t & demux )
                         ( p_current_chapter->p_chapter->i_end_time != p_cur_chapter->p_chapter->i_start_time ) ||
                         ( p_current_chapter && p_current_chapter->p_segment != p_cur_chapter->p_segment ) )
                     {
-                        /* hack : we have to use input to seek in order to clean buffers */
-                        var_SetTime( demux.p_sys->p_input, "time", p_cur_chapter->i_virtual_start_time );
+                        Seek( demux, p_cur_chapter->i_virtual_start_time, 0, p_cur_chapter, -1 );
                         return true;
                     }
                 }
@@ -450,7 +449,6 @@ void virtual_segment_c::Seek( demux_t & demuxer, mtime_t i_date, mtime_t i_time_
 
         if( p_current_chapter->p_segment != p_chapter->p_segment )
         {
-            es_out_Control( demuxer.out, ES_OUT_RESET_PCR );
             p_chapter->p_segment->Select( i_date );
             p_current_chapter->p_segment->UnSelect();
         }
-- 
1.7.8.3




More information about the vlc-devel mailing list