[vlc-devel] [PATCH] demux: mkv: fix seek
Zhao Zhili
quinkblack at foxmail.com
Fri Jun 29 17:56:39 CEST 2018
> On Jun 29, 2018, at 10:36 PM, Steve Lhomme <robux4 at ycbcr.xyz> wrote:
>
> Hi
>
>
> On 2018-06-26 11:48, Zhao Zhili wrote:
>> This fixes a regression from 6b10c2e6. Seek failed due to empty
>> _tracks_seekpoints[video_track].
>> ---
>> modules/demux/mkv/matroska_segment.cpp | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>>
>> diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
>> index 148e66e..844558c 100644
>> --- a/modules/demux/mkv/matroska_segment.cpp
>> +++ b/modules/demux/mkv/matroska_segment.cpp
>> @@ -635,6 +635,15 @@ bool matroska_segment_c::Preload( )
>> cluster = kc_ptr;
>> +
>> + // add first cluster as trusted seekpoint for all tracks
>
> Not exactly trusted, it just kickstarts the seeking with a known position.
>
>> + for( tracks_map_t::const_iterator it = tracks.begin();
>> + it != tracks.end(); ++it )
>> + {
>> + _seeker.add_seekpoint( it->first,
>> + SegmentSeeker::Seekpoint( cluster->GetElementPosition(), 0 ) );
>
> It marks the Seekpoint as TRUSTED, ie sure to be a seek point for that track because we encountered a keyframe. Thie may not be the case at all.
> SegmentSeeker::Seekpoint::TrustLevel::QUESTIONABLE would be better here.
Good point.
>
> Also a pts of 0 may not be correct. A Segment can start with a high PTS if it's the continuation of a previous Segment. So using -1 here is better (technically it should be VLC_TS_INVALID but that's not what the code expects).
Yes, -1 is better. Technically it should be VLC_TS_LOWER_BOUND but we don't have that. INVALID doesn't mean it's small, although let VLC_TS_INVALID equal to INT64_MAX will break a lot of code I guess.
>
> After these 2 changes the fix still works but it's cleaner.
>
>> + }
>> +
>> /* stop pre-parsing the stream */
>> break;
>> }
>> --
>> 2.9.5
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list