[vlc-commits] demux: adaptive: set live start position on first buffering

Francois Cartegnie git at videolan.org
Mon Jul 20 21:03:20 CEST 2020


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jul 17 19:51:09 2020 +0200| [be0195644722c9f026e0c0a33d8386aeda43bcfc] | committer: Francois Cartegnie

demux: adaptive: set live start position on first buffering

In some cases, the start point does not provide sufficient
buffering and is then rescheduled in the same way.

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

 modules/demux/adaptive/SegmentTracker.cpp | 13 +++++++++++++
 modules/demux/adaptive/SegmentTracker.hpp |  1 +
 modules/demux/adaptive/Streams.cpp        |  2 ++
 3 files changed, 16 insertions(+)

diff --git a/modules/demux/adaptive/SegmentTracker.cpp b/modules/demux/adaptive/SegmentTracker.cpp
index ceca27629c..c83a6f1fec 100644
--- a/modules/demux/adaptive/SegmentTracker.cpp
+++ b/modules/demux/adaptive/SegmentTracker.cpp
@@ -404,6 +404,19 @@ SegmentTracker::Position SegmentTracker::getStartPosition()
     return pos;
 }
 
+bool SegmentTracker::setStartPosition()
+{
+    if(next.isValid())
+        return true;
+
+    Position pos = getStartPosition();
+    if(!pos.isValid())
+        return false;
+
+    next = pos;
+    return true;
+}
+
 vlc_tick_t SegmentTracker::getPlaybackTime(bool b_next) const
 {
     vlc_tick_t time, duration;
diff --git a/modules/demux/adaptive/SegmentTracker.hpp b/modules/demux/adaptive/SegmentTracker.hpp
index 8ad8e44845..cdaeff9510 100644
--- a/modules/demux/adaptive/SegmentTracker.hpp
+++ b/modules/demux/adaptive/SegmentTracker.hpp
@@ -145,6 +145,7 @@ namespace adaptive
             SegmentChunk* getNextChunk(bool, AbstractConnectionManager *);
             bool setPositionByTime(vlc_tick_t, bool, bool);
             void setPosition(const Position &, bool);
+            bool setStartPosition();
             Position getStartPosition();
             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;
diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
index c153a68618..77dceeaf06 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -342,6 +342,8 @@ AbstractStream::buffering_status AbstractStream::doBufferize(vlc_tick_t nz_deadl
         return AbstractStream::buffering_suspended;
     }
 
+    segmentTracker->setStartPosition();
+
     /* Reached end of live playlist */
     if(!segmentTracker->bufferingAvailable())
     {



More information about the vlc-commits mailing list