[vlc-commits] demux: hls: set more accurate update time

Francois Cartegnie git at videolan.org
Thu May 14 15:30:20 CEST 2020


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed May 13 17:19:20 2020 +0200| [5c9c9e907096dee7cf23309c1d125a69f443cd32] | committer: Francois Cartegnie

demux: hls: set more accurate update time

(cherry picked from commit 706d5213945aa40caa6d93a359822b004ae2525f)

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

 modules/demux/hls/playlist/Representation.cpp | 8 ++++----
 modules/demux/hls/playlist/Representation.hpp | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/demux/hls/playlist/Representation.cpp b/modules/demux/hls/playlist/Representation.cpp
index f82d5bc662..ea05270157 100644
--- a/modules/demux/hls/playlist/Representation.cpp
+++ b/modules/demux/hls/playlist/Representation.cpp
@@ -103,7 +103,7 @@ void Representation::debug(vlc_object_t *obj, int indent) const
 void Representation::scheduleNextUpdate(uint64_t number)
 {
     const AbstractPlaylist *playlist = getPlaylist();
-    const time_t now = time(NULL);
+    const mtime_t now = mdate();
 
     /* Compute new update time */
     mtime_t minbuffer = getMinAheadTime(number);
@@ -125,17 +125,17 @@ void Representation::scheduleNextUpdate(uint64_t number)
             minbuffer /= 2;
     }
 
-    nextUpdateTime = now + minbuffer / CLOCK_FREQ;
+    nextUpdateTime = now + minbuffer;
 
     msg_Dbg(playlist->getVLCObject(), "Updated playlist ID %s, next update in %" PRId64 "s",
-            getID().str().c_str(), (mtime_t) nextUpdateTime - now);
+            getID().str().c_str(), (nextUpdateTime - now)/CLOCK_FREQ);
 
     debug(playlist->getVLCObject(), 0);
 }
 
 bool Representation::needsUpdate() const
 {
-    return !b_failed && (!b_loaded || (isLive() && nextUpdateTime < time(NULL)));
+    return !b_failed && (!b_loaded || (isLive() && nextUpdateTime < mdate()));
 }
 
 bool Representation::runLocalUpdates(SharedResources *res)
diff --git a/modules/demux/hls/playlist/Representation.hpp b/modules/demux/hls/playlist/Representation.hpp
index 8446750f86..12b7ceedf9 100644
--- a/modules/demux/hls/playlist/Representation.hpp
+++ b/modules/demux/hls/playlist/Representation.hpp
@@ -58,7 +58,7 @@ namespace hls
                 bool b_live;
                 bool b_loaded;
                 bool b_failed;
-                time_t nextUpdateTime;
+                mtime_t nextUpdateTime;
                 time_t targetDuration;
                 Url playlistUrl;
         };



More information about the vlc-commits mailing list