[vlc-commits] demux:mkv: simplify the code as we always disable the trust check with get_seekpoints_around()

Steve Lhomme git at videolan.org
Fri Aug 4 10:07:43 CEST 2017


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Thu Aug  3 18:18:31 2017 +0200| [2a931e0756f09511d9d759020cc27b49f34b2259] | committer: Jean-Baptiste Kempf

demux:mkv: simplify the code as we always disable the trust check with get_seekpoints_around()

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2a931e0756f09511d9d759020cc27b49f34b2259
---

 modules/demux/mkv/matroska_segment_seeker.cpp | 21 +++------------------
 modules/demux/mkv/matroska_segment_seeker.hpp |  2 +-
 2 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment_seeker.cpp b/modules/demux/mkv/matroska_segment_seeker.cpp
index 55b303d424..f9ee930d62 100644
--- a/modules/demux/mkv/matroska_segment_seeker.cpp
+++ b/modules/demux/mkv/matroska_segment_seeker.cpp
@@ -179,8 +179,7 @@ SegmentSeeker::get_first_seekpoint_around( mtime_t pts, seekpoints_t const& seek
 }
 
 SegmentSeeker::seekpoint_pair_t
-SegmentSeeker::get_seekpoints_around( mtime_t pts, seekpoints_t const& seekpoints,
-                                      Seekpoint::TrustLevel trust_level )
+SegmentSeeker::get_seekpoints_around( mtime_t pts, seekpoints_t const& seekpoints )
 {
     if( seekpoints.empty() )
     {
@@ -195,22 +194,8 @@ SegmentSeeker::get_seekpoints_around( mtime_t pts, seekpoints_t const& seekpoint
     iterator const it_end    = seekpoints.end();
     iterator const it_middle = greatest_lower_bound( it_begin, it_end, needle );
 
-    iterator it_before;
-    iterator it_after;
-
-    // rewrind to _previous_ seekpoint with appropriate trust
-    for( it_before = it_middle; it_before != it_begin; --it_before )
-    {
-        if( it_before->trust_level >= trust_level )
-            break;
-    }
-
-    // forward to following seekpoint with appropriate trust
-    for( it_after = next_( it_middle ); it_after != it_end; ++it_after )
-    {
-        if( it_after->trust_level >= trust_level )
-            break;
-    }
+    iterator it_before = it_middle;
+    iterator it_after = it_middle == it_end ? it_middle : next_( it_middle ) ;
 
     return seekpoint_pair_t( *it_before,
       it_after == it_end ? Seekpoint() : *it_after
diff --git a/modules/demux/mkv/matroska_segment_seeker.hpp b/modules/demux/mkv/matroska_segment_seeker.hpp
index 6af3f51d9a..76608c6fb3 100644
--- a/modules/demux/mkv/matroska_segment_seeker.hpp
+++ b/modules/demux/mkv/matroska_segment_seeker.hpp
@@ -101,7 +101,7 @@ class SegmentSeeker
 
         void add_seekpoint( track_id_t track_id, Seekpoint::TrustLevel level, fptr_t fpos, mtime_t pts );
 
-        seekpoint_pair_t get_seekpoints_around( mtime_t, seekpoints_t const&, Seekpoint::TrustLevel = Seekpoint::DISABLED );
+        seekpoint_pair_t get_seekpoints_around( mtime_t, seekpoints_t const& );
         Seekpoint get_first_seekpoint_around( mtime_t, seekpoints_t const&, Seekpoint::TrustLevel = Seekpoint::TRUSTED );
         seekpoint_pair_t get_seekpoints_around( mtime_t, track_ids_t const& );
 



More information about the vlc-commits mailing list