[vlc-commits] demux:adaptive: use vlc_tick_from_sec() for more explicit conversion

Steve Lhomme git at videolan.org
Fri Jul 6 09:20:48 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Jun 11 14:29:02 2018 +0200| [7eb293521e6a77eff436e6e799f221f8fc2c94ae] | committer: Steve Lhomme

demux:adaptive: use vlc_tick_from_sec() for more explicit conversion

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

 modules/demux/adaptive/playlist/SegmentTemplate.cpp | 2 +-
 modules/demux/hls/playlist/Representation.cpp       | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/demux/adaptive/playlist/SegmentTemplate.cpp b/modules/demux/adaptive/playlist/SegmentTemplate.cpp
index c00348d839..a81b53a50d 100644
--- a/modules/demux/adaptive/playlist/SegmentTemplate.cpp
+++ b/modules/demux/adaptive/playlist/SegmentTemplate.cpp
@@ -89,7 +89,7 @@ uint64_t MediaSegmentTemplate::getCurrentLiveTemplateNumber() const
         const Timescale timescale = inheritTimescale();
         time_t streamstart = parentSegmentInformation->getPlaylist()->availabilityStartTime.Get();
         streamstart += parentSegmentInformation->getPeriodStart();
-        stime_t elapsed = timescale.ToScaled(CLOCK_FREQ * (playbacktime - streamstart));
+        stime_t elapsed = timescale.ToScaled(vlc_tick_from_sec(playbacktime - streamstart));
         number += elapsed / dur - 2;
     }
 
diff --git a/modules/demux/hls/playlist/Representation.cpp b/modules/demux/hls/playlist/Representation.cpp
index 61be13da57..24722eb26d 100644
--- a/modules/demux/hls/playlist/Representation.cpp
+++ b/modules/demux/hls/playlist/Representation.cpp
@@ -111,10 +111,10 @@ void Representation::scheduleNextUpdate(uint64_t number)
      * but we need to update before reaching that last segment, thus -1 */
     if(targetDuration)
     {
-        if(minbuffer > CLOCK_FREQ * ( 2 * targetDuration + 1 ))
-            minbuffer -= CLOCK_FREQ * ( targetDuration + 1 );
+        if(minbuffer > vlc_tick_from_sec( 2 * targetDuration + 1 ))
+            minbuffer -= vlc_tick_from_sec( targetDuration + 1 );
         else
-            minbuffer = CLOCK_FREQ * ( targetDuration - 1 );
+            minbuffer = vlc_tick_from_sec( targetDuration - 1 );
     }
     else
     {



More information about the vlc-commits mailing list