[vlc-commits] [Git][videolan/vlc][master] 2 commits: demux: mkv: do not look for seekpoints in slow seek sources

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu May 14 13:09:02 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
05e105ce by Steve Lhomme at 2026-05-14T12:53:51+00:00
demux: mkv: do not look for seekpoints in slow seek sources

It's reading blocks until it has a known timestamp. But we don't want that in slow
sources. We just read sequentially when possible.

- - - - -
04e596de by Steve Lhomme at 2026-05-14T12:53:51+00:00
demux: mkv: do not use new parser if it was reconstructed

This happens at the start of a streaming file (slow seeking) where the first
cluster found is not added yet as we will keep on reading from there.

Fixes #27957

- - - - -


1 changed file:

- modules/demux/mkv/matroska_segment_seeker.cpp


Changes:

=====================================
modules/demux/mkv/matroska_segment_seeker.cpp
=====================================
@@ -318,7 +318,8 @@ SegmentSeeker::get_seekpoints( matroska_segment_c& ms, vlc_tick_t target_pts,
         if ( start.fpos == std::numeric_limits<fptr_t>::max() )
             return tracks_seekpoint_t();
 
-        if ( (end.fpos != std::numeric_limits<fptr_t>::max() || !ms.b_cues) &&
+        if ( ms.sys.b_fastseekable &&
+             (end.fpos != std::numeric_limits<fptr_t>::max() || !ms.b_cues) &&
              (needle_pts != start.pts || start.trust_level < Seekpoint::TRUSTED))
             // do not read the whole (infinite?) file to get seek indexes
             // do not generate an index if we already have the correct seekpoint
@@ -485,30 +486,30 @@ SegmentSeeker::mkv_jump_to( matroska_segment_c& ms, fptr_t fpos )
 
             ms.es.I_O().setFilePointer( *cluster_it );
             ms.ep.reconstruct( &ms.es, ms.segment, &ms.sys.demuxer );
-        }
 
-        for(;;)
-        {
-            ms.cluster = NULL;
-            EbmlElement *el = ms.ep.Get();
-            if( el == nullptr )
+            for(;;)
             {
-                msg_Err( &ms.sys.demuxer, "unable to read KaxCluster during seek, giving up" );
-                return;
-            }
-            if (!MKV_IS_ID( el, KaxCluster ))
-                continue; // look for the next element
+                ms.cluster = NULL;
+                EbmlElement *el = ms.ep.Get();
+                if( el == nullptr )
+                {
+                    msg_Err( &ms.sys.demuxer, "unable to read KaxCluster during seek, giving up" );
+                    return;
+                }
+                if (!MKV_IS_ID( el, KaxCluster ))
+                    continue; // look for the next element
 
-            ms.cluster = static_cast<KaxCluster*>( el );
+                ms.cluster = static_cast<KaxCluster*>( el );
 
-            i_cluster_pos = ms.cluster->GetElementPosition();
+                i_cluster_pos = ms.cluster->GetElementPosition();
 
-            add_cluster_position( i_cluster_pos );
+                add_cluster_position( i_cluster_pos );
 
-            mark_range_as_searched( Range( i_cluster_pos, ms.es.I_O().getFilePointer() ) );
+                mark_range_as_searched( Range( i_cluster_pos, ms.es.I_O().getFilePointer() ) );
 
-            if ( !ms.cluster->IsFiniteSize() || ms.cluster->GetEndPosition() >= fpos)
-                break;
+                if ( !ms.cluster->IsFiniteSize() || ms.cluster->GetEndPosition() >= fpos)
+                    break;
+            }
         }
     }
     else if (ms.cluster != NULL)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fa23258823cc714796df9a8278250d98a50b9e82...04e596de5cb46bee1bc804aa048030828e9f98f2

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fa23258823cc714796df9a8278250d98a50b9e82...04e596de5cb46bee1bc804aa048030828e9f98f2
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list