[vlc-commits] demux: dash: check template seek range

Francois Cartegnie git at videolan.org
Fri Apr 3 10:52:32 CEST 2020


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Apr  2 17:05:29 2020 +0200| [1341e55e074c03fdd2879abdabb4c9ca84706d47] | committer: Francois Cartegnie

demux: dash: check template seek range

(cherry picked from commit 8f9195f75e3c2a2f041440def1bb1875dbce324a)

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

 modules/demux/adaptive/playlist/SegmentInformation.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/modules/demux/adaptive/playlist/SegmentInformation.cpp b/modules/demux/adaptive/playlist/SegmentInformation.cpp
index 81a326c82f..2284189cca 100644
--- a/modules/demux/adaptive/playlist/SegmentInformation.cpp
+++ b/modules/demux/adaptive/playlist/SegmentInformation.cpp
@@ -329,7 +329,15 @@ bool SegmentInformation::getSegmentNumberByTime(mtime_t time, uint64_t *ret) con
         {
             if( getPlaylist()->isLive() )
             {
-                *ret = mediaSegmentTemplate->getLiveTemplateNumber(time, false);
+                mtime_t now = CLOCK_FREQ * ::time(NULL);
+                if(getPlaylist()->availabilityStartTime.Get())
+                {
+                    if(time >= getPlaylist()->availabilityStartTime.Get() && time < now)
+                        *ret = mediaSegmentTemplate->getLiveTemplateNumber(time, true);
+                    else if(now - getPlaylist()->availabilityStartTime.Get() > time)
+                        *ret = mediaSegmentTemplate->getLiveTemplateNumber(time, false);
+                }
+                else return false;
             }
             else
             {



More information about the vlc-commits mailing list