[vlc-commits] demux: adaptive: set current segment start time on init

Francois Cartegnie git at videolan.org
Mon May 25 13:29:04 CEST 2020


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri May 22 12:42:05 2020 +0200| [b8430ae00d572f47b96b6904adda3e20abfade66] | committer: Francois Cartegnie

demux: adaptive: set current segment start time on init

(cherry picked from commit 0cb5b91f975b4bcfd2bfb7a05776726941d634b4)

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

 modules/demux/adaptive/SegmentTracker.cpp | 4 ++--
 modules/demux/adaptive/SegmentTracker.hpp | 2 +-
 modules/demux/adaptive/Streams.cpp        | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/demux/adaptive/SegmentTracker.cpp b/modules/demux/adaptive/SegmentTracker.cpp
index 27c56028e4..c987cb40ae 100644
--- a/modules/demux/adaptive/SegmentTracker.cpp
+++ b/modules/demux/adaptive/SegmentTracker.cpp
@@ -354,7 +354,7 @@ void SegmentTracker::setPositionByNumber(uint64_t segnumber, bool restarted)
     curNumber = next = segnumber;
 }
 
-mtime_t SegmentTracker::getPlaybackTime() const
+mtime_t SegmentTracker::getPlaybackTime(bool b_next) const
 {
     mtime_t time, duration;
 
@@ -363,7 +363,7 @@ mtime_t SegmentTracker::getPlaybackTime() const
         rep = logic->getNextRepresentation(adaptationSet, NULL);
 
     if(rep &&
-       rep->getPlaybackTimeDurationBySegmentNumber(next, &time, &duration))
+       rep->getPlaybackTimeDurationBySegmentNumber(b_next ? next : curNumber, &time, &duration))
     {
         return time;
     }
diff --git a/modules/demux/adaptive/SegmentTracker.hpp b/modules/demux/adaptive/SegmentTracker.hpp
index bb6e3bd7e4..e0c7a1bfe1 100644
--- a/modules/demux/adaptive/SegmentTracker.hpp
+++ b/modules/demux/adaptive/SegmentTracker.hpp
@@ -132,7 +132,7 @@ namespace adaptive
             SegmentChunk* getNextChunk(bool, AbstractConnectionManager *);
             bool setPositionByTime(mtime_t, bool, bool);
             void setPositionByNumber(uint64_t, bool);
-            mtime_t getPlaybackTime() const; /* Current segment start time if selected */
+            mtime_t getPlaybackTime(bool = false) const; /* Current segment start time if selected */
             bool getMediaPlaybackRange(mtime_t *, mtime_t *, mtime_t *) const;
             mtime_t getMinAheadTime() const;
             void notifyBufferingState(bool) const;
diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
index 8ca86a8897..f3bbed2b27 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -560,7 +560,7 @@ bool AbstractStream::setPosition(mtime_t time, bool tryonly)
 
             fakeEsOut()->resetTimestamps();
 
-            mtime_t seekMediaTime = segmentTracker->getPlaybackTime();
+            mtime_t seekMediaTime = segmentTracker->getPlaybackTime(true);
             fakeEsOut()->setExpectedTimestamp(seekMediaTime);
             if( !restartDemux() )
             {



More information about the vlc-commits mailing list