demux: dash: compute missing starttime on timeline elements
authorFrancois Cartegnie <fcvlcdev@free.fr>
Thu, 8 Jan 2015 18:12:55 +0000 (19:12 +0100)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Mon, 12 Jan 2015 19:21:57 +0000 (20:21 +0100)
modules/demux/dash/mpd/SegmentTimeline.cpp

index 07c4dbf..540dd9c 100644 (file)
@@ -44,7 +44,14 @@ void SegmentTimeline::addElement(mtime_t d, uint64_t r, mtime_t t)
 {
     Element *element = new (std::nothrow) Element(d, r, t);
     if(element)
+    {
+        if(!elements.empty() && !t)
+        {
+            const Element *el = elements.back();
+            element->t = el->t + (el->d * (el->r + 1));
+        }
         elements.push_back(element);
+    }
 }
 
 uint64_t SegmentTimeline::getElementNumberByScaledPlaybackTime(time_t scaled) const