[vlc-devel] [PATCH 2/2] demux/mkv: fix ES handling during DEMUX_SET_TITLE

Filip Roséen filip at atch.se
Mon Feb 20 18:10:20 CET 2017

As part of seeking to a new virtual chapter, we have to destroy the
elementary streams that are part of the current one, and then create
the streams associated with the seeking-to virtual chapter.

This is done in virtual_segment_c::Seek, and is based on whether
p_current_vsegment->p_current_vchapter is equal to the virtual chapter
which we are seeking to.

The previous implementation would set "p_sys->p_current_vsegment->p_current_vchapter"
prior to calling virtual_segment_c::Seek, which makes the
seek-implementation think that we are seeking within the same virtual
chapter (retaining the previous elementary streams, and not creating
new ones).

By removing the relevant assignment under DEMUX_SET_TITLE we let
virtual_segment_c::Seek handle the necessary switching, preventing the
new title to be played from not having the necessary elementary-streams
created (to actually be playable).
 modules/demux/mkv/mkv.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 47e4d3ee61..1319b4985b 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -387,7 +387,6 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                 p_sys->p_current_vsegment->i_current_edition = i_idx;
                 p_sys->i_current_title = i_idx;
-                p_sys->p_current_vsegment->p_current_vchapter = p_sys->p_current_vsegment->veditions[p_sys->p_current_vsegment->i_current_edition]->getChapterbyTimecode(0);
                 Seek( p_demux, static_cast<int64_t>( p_sys->titles[i_idx]->seekpoint[0]->i_time_offset ), -1, NULL);
                 p_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT|INPUT_UPDATE_TITLE;

More information about the vlc-devel mailing list