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

Francois Cartegnie git at videolan.org
Thu Apr 2 18:09:14 CEST 2020


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Apr  2 17:05:29 2020 +0200| [8f9195f75e3c2a2f041440def1bb1875dbce324a] | committer: Francois Cartegnie

demux: dash: check template seek range

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

 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 adbead58f1..ac95876a2d 100644
--- a/modules/demux/adaptive/playlist/SegmentInformation.cpp
+++ b/modules/demux/adaptive/playlist/SegmentInformation.cpp
@@ -329,7 +329,15 @@ bool SegmentInformation::getSegmentNumberByTime(vlc_tick_t time, uint64_t *ret)
         {
             if( getPlaylist()->isLive() )
             {
-                *ret = mediaSegmentTemplate->getLiveTemplateNumber(time, false);
+                vlc_tick_t now = vlc_tick_from_sec(::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