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

Francois Cartegnie git at videolan.org
Thu May 14 10:18:48 CEST 2020


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed May 13 17:19:20 2020 +0200| [706d5213945aa40caa6d93a359822b004ae2525f] | committer: Francois Cartegnie

demux: hls: set more accurate update time

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

 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 ba410c38f2..ec790e488e 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 vlc_tick_t now = vlc_tick_now();
 
     /* Compute new update time */
     vlc_tick_t minbuffer = getMinAheadTime(number);
@@ -125,17 +125,17 @@ void Representation::scheduleNextUpdate(uint64_t number)
             minbuffer /= 2;
     }
 
-    nextUpdateTime = now + SEC_FROM_VLC_TICK(minbuffer);
+    nextUpdateTime = now + minbuffer;
 
     msg_Dbg(playlist->getVLCObject(), "Updated playlist ID %s, next update in %" PRId64 "s",
-            getID().str().c_str(), (int64_t) nextUpdateTime - now);
+            getID().str().c_str(), SEC_FROM_VLC_TICK(nextUpdateTime - now));
 
     debug(playlist->getVLCObject(), 0);
 }
 
 bool Representation::needsUpdate() const
 {
-    return !b_failed && (!b_loaded || (isLive() && nextUpdateTime < time(NULL)));
+    return !b_failed && (!b_loaded || (isLive() && nextUpdateTime < vlc_tick_now()));
 }
 
 bool Representation::runLocalUpdates(SharedResources *res)
diff --git a/modules/demux/hls/playlist/Representation.hpp b/modules/demux/hls/playlist/Representation.hpp
index 8446750f86..815981d57c 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;
+                vlc_tick_t nextUpdateTime;
                 time_t targetDuration;
                 Url playlistUrl;
         };



More information about the vlc-commits mailing list