[vlc-devel] [PATCH] demux: mkv: add the first cluster position to seeker

Zhao Zhili quinkblack at foxmail.com
Wed Oct 3 18:30:39 CEST 2018


Please review, thanks!

On 9/12/18 11:42 AM, Zhao Zhili wrote:
> Otherwise SegmentSeeker::mkv_jump_to may miss the first cluster.
> ---
> Missing the first cluster leads to blured screen for the sample
> https://drive.google.com/open?id=1Tu8K2Y63mFnYCMaHo4KzvmKNkRCB3ewR
> I think the seeker needs some kind of fix/cleanup but I don't know how.
> 
>   modules/demux/mkv/matroska_segment.cpp | 16 ++++++++++------
>   1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
> index ef89457..837a3b2 100644
> --- a/modules/demux/mkv/matroska_segment.cpp
> +++ b/modules/demux/mkv/matroska_segment.cpp
> @@ -638,13 +638,17 @@ bool matroska_segment_c::Preload( )
>   
>               cluster = kc_ptr;
>   
> -            // add first cluster as trusted seekpoint for all tracks
> -            for( tracks_map_t::const_iterator it = tracks.begin();
> -                 it != tracks.end(); ++it )
> +            if( sys.b_seekable )
>               {
> -                _seeker.add_seekpoint( it->first,
> -                SegmentSeeker::Seekpoint( cluster->GetElementPosition(), -1,
> -                                          SegmentSeeker::Seekpoint::TrustLevel::QUESTIONABLE ) );
> +                _seeker.add_cluster_position( cluster->GetElementPosition() );
> +                // add first cluster as questionable seekpoint for all tracks
> +                for( tracks_map_t::const_iterator it = tracks.begin();
> +                     it != tracks.end(); ++it )
> +                {
> +                    _seeker.add_seekpoint( it->first,
> +                    SegmentSeeker::Seekpoint( cluster->GetElementPosition(), -1,
> +                                              SegmentSeeker::Seekpoint::TrustLevel::QUESTIONABLE ) );
> +                }
>               }
>   
>               /* stop pre-parsing the stream */
> 



More information about the vlc-devel mailing list