[vlc-commits] demux: adaptive: fix getPlaybackTimeDurationBySegmentNumber startnumber offset

Francois Cartegnie git at videolan.org
Tue Mar 17 12:42:24 CET 2020


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Mar  9 17:03:50 2020 +0100| [1d0e48f08e67e987ed549b01520fe1db48e933fd] | committer: Francois Cartegnie

demux: adaptive: fix getPlaybackTimeDurationBySegmentNumber startnumber offset

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

 modules/demux/adaptive/playlist/SegmentInformation.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/demux/adaptive/playlist/SegmentInformation.cpp b/modules/demux/adaptive/playlist/SegmentInformation.cpp
index 021b874882..cbdeeee3d8 100644
--- a/modules/demux/adaptive/playlist/SegmentInformation.cpp
+++ b/modules/demux/adaptive/playlist/SegmentInformation.cpp
@@ -505,8 +505,11 @@ bool SegmentInformation::getPlaybackTimeDurationBySegmentNumber(uint64_t number,
         }
         else
         {
-            stime = number * mediaTemplate->duration.Get();
-            sduration = mediaTemplate->duration.Get();
+            uint64_t startNumber = mediaTemplate->inheritStartNumber();
+            if(number < startNumber)
+                return false;
+            sduration = mediaTemplate->inheritDuration();
+            stime = (number - startNumber) * sduration;
         }
         *time = timescale.ToTime(stime);
         *duration = timescale.ToTime(sduration);



More information about the vlc-commits mailing list