[vlc-commits] demux: adaptive: fix negative livestart number

Francois Cartegnie git at videolan.org
Mon Dec 14 10:41:39 UTC 2020


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Nov 26 21:07:39 2020 +0100| [4da275b85ea69a963fee1497e7e5911a9ad713af] | committer: Francois Cartegnie

demux: adaptive: fix negative livestart number

(cherry picked from commit a0d053d40295be6c30cbe023a460865ffd3b2f83)

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

 modules/demux/adaptive/logic/BufferingLogic.cpp | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/demux/adaptive/logic/BufferingLogic.cpp b/modules/demux/adaptive/logic/BufferingLogic.cpp
index c95efc803e..f230daa56f 100644
--- a/modules/demux/adaptive/logic/BufferingLogic.cpp
+++ b/modules/demux/adaptive/logic/BufferingLogic.cpp
@@ -302,11 +302,14 @@ uint64_t DefaultBufferingLogic::getLiveStartSegmentNumber(BaseRepresentation *re
         uint64_t safeedgenumber = back->getSequenceNumber() -
                         std::min((uint64_t)list.size() - 1,
                                  (uint64_t)SAFETY_BUFFERING_EDGE_OFFSET);
-
         uint64_t safestartnumber = availableliststartnumber;
-        if(safeedgenumber > safestartnumber)
-            safestartnumber -= std::min(safeedgenumber-safestartnumber - 1,
-                                        (uint64_t)SAFETY_EXPURGING_OFFSET);
+
+        for(unsigned i=0; i<SAFETY_EXPURGING_OFFSET; i++)
+        {
+            if(safestartnumber + 1 >= safeedgenumber)
+                break;
+            safestartnumber++;
+        }
 
         stime_t maxbufferizable = 0;
         stime_t safeedgeduration = 0;



More information about the vlc-commits mailing list