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

Francois Cartegnie git at videolan.org
Mon Mar 30 16:16:39 CEST 2020


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

demux: adaptive: fix getPlaybackTimeDurationBySegmentNumber startnumber offset

(cherry picked from commit 1d0e48f08e67e987ed549b01520fe1db48e933fd)

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

 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 48df829069..983fa0469f 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