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

Francois Cartegnie git at videolan.org
Fri May 22 13:59:07 CEST 2020


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

demux: adaptive: set current segment start time on init

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

 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 1a5f857d42..2bac8d17f2 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;
 }
 
-vlc_tick_t SegmentTracker::getPlaybackTime() const
+vlc_tick_t SegmentTracker::getPlaybackTime(bool b_next) const
 {
     vlc_tick_t time, duration;
 
@@ -363,7 +363,7 @@ vlc_tick_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 91dd84c792..54555c96f8 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(vlc_tick_t, bool, bool);
             void setPositionByNumber(uint64_t, bool);
-            vlc_tick_t getPlaybackTime() const; /* Current segment start time if selected */
+            vlc_tick_t getPlaybackTime(bool = false) const; /* Current segment start time if selected */
             bool getMediaPlaybackRange(vlc_tick_t *, vlc_tick_t *, vlc_tick_t *) const;
             vlc_tick_t getMinAheadTime() const;
             void notifyBufferingState(bool) const;
diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
index 87171d76ae..6ba934425d 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -558,7 +558,7 @@ bool AbstractStream::setPosition(vlc_tick_t time, bool tryonly)
 
             fakeEsOut()->resetTimestamps();
 
-            vlc_tick_t seekMediaTime = segmentTracker->getPlaybackTime();
+            vlc_tick_t seekMediaTime = segmentTracker->getPlaybackTime(true);
             fakeEsOut()->setExpectedTimestamp(seekMediaTime);
             if( !restartDemux() )
             {



More information about the vlc-commits mailing list