[vlc-commits] demux: adaptative: fix timeline number to time

Francois Cartegnie git at videolan.org
Mon Sep 28 22:49:41 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Sep 28 18:01:02 2015 +0200| [4c0c0d37fdb319c509c3adb7147250a6b0bcbf88] | committer: Francois Cartegnie

demux: adaptative: fix timeline number to time

regression since using absolute numbering

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

 .../demux/adaptative/playlist/SegmentTimeline.cpp  |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/modules/demux/adaptative/playlist/SegmentTimeline.cpp b/modules/demux/adaptative/playlist/SegmentTimeline.cpp
index 7bbef44..637260d 100644
--- a/modules/demux/adaptative/playlist/SegmentTimeline.cpp
+++ b/modules/demux/adaptative/playlist/SegmentTimeline.cpp
@@ -85,14 +85,22 @@ stime_t SegmentTimeline::getScaledPlaybackTimeByElementNumber(uint64_t number) c
     {
         const Element *el = *it;
 
-        if(number >= el->number)
+        /* set start time, or from discontinuity */
+        if(it == elements.begin() || el->t)
         {
-            if(number <= el->number + el->r)
-            {
-                return el->t + (number * el->d);
-            }
-            totalscaledtime = el->t + (number * el->d);
+            totalscaledtime = el->t;
         }
+
+        if(number <= el->number)
+            break;
+
+        if(number <= el->number + el->r)
+        {
+            totalscaledtime += el->d * (number - el->number);
+            break;
+        }
+
+        totalscaledtime += (el->d * (el->r + 1));
     }
 
     return totalscaledtime;



More information about the vlc-commits mailing list