[vlc-commits] demux: hls: update live refresh interval

Francois Cartegnie git at videolan.org
Tue Dec 29 21:55:47 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Dec 29 21:50:28 2015 +0100| [ee8c9ec3f4202d7286e7c95f333f0aa9493a8ef7] | committer: Francois Cartegnie

demux: hls: update live refresh interval

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

 modules/demux/hls/playlist/Representation.cpp |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/modules/demux/hls/playlist/Representation.cpp b/modules/demux/hls/playlist/Representation.cpp
index cb5229a..839e13f 100644
--- a/modules/demux/hls/playlist/Representation.cpp
+++ b/modules/demux/hls/playlist/Representation.cpp
@@ -106,22 +106,23 @@ void Representation::scheduleNextUpdate(uint64_t number)
     /* Compute new update time */
     mtime_t minbuffer = getMinAheadTime(number);
 
-    /* Update frequency must always be at least targetDuration (if any)*/
+    /* Update frequency must always be at least targetDuration (if any)
+     * but we need to update before reaching that last segment, thus -1 */
     if(targetDuration)
     {
-        if(minbuffer >= 3 * CLOCK_FREQ * targetDuration)
-            minbuffer -= 2 * CLOCK_FREQ * targetDuration;
+        if(minbuffer > CLOCK_FREQ * ( 2 * targetDuration + 1 ))
+            minbuffer -= CLOCK_FREQ * ( targetDuration + 1 );
+        else
+            minbuffer = CLOCK_FREQ * ( targetDuration - 1 );
     }
     else
     {
-        minbuffer /= 2;
-        if(targetDuration > minbuffer / CLOCK_FREQ)
-            minbuffer = targetDuration * CLOCK_FREQ;
+        if(minbuffer < 10 * CLOCK_FREQ)
+            minbuffer = 4 * CLOCK_FREQ;
+        else
+            minbuffer /= 2;
     }
 
-    if(minbuffer < CLOCK_FREQ)
-        minbuffer = CLOCK_FREQ;
-
     nextUpdateTime = now + minbuffer / CLOCK_FREQ;
 
     msg_Dbg(playlist->getVLCObject(), "Updated playlist ID %s, next update in %" PRId64 "s",



More information about the vlc-commits mailing list