[vlc-commits] adaptive: dash: handle suggestedPresentationDelay

Francois Cartegnie git at videolan.org
Fri Jan 13 15:28:04 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jan 13 14:20:27 2017 +0100| [849488eee62f72467fe66dc7b4f77efb1343d19b] | committer: Francois Cartegnie

adaptive: dash: handle suggestedPresentationDelay

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

 modules/demux/adaptive/playlist/AbstractPlaylist.cpp   | 1 +
 modules/demux/adaptive/playlist/AbstractPlaylist.hpp   | 1 +
 modules/demux/adaptive/playlist/SegmentInformation.cpp | 8 ++++++--
 modules/demux/dash/mpd/IsoffMainParser.cpp             | 4 ++++
 4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/modules/demux/adaptive/playlist/AbstractPlaylist.cpp b/modules/demux/adaptive/playlist/AbstractPlaylist.cpp
index fb2b7da..75a3848 100644
--- a/modules/demux/adaptive/playlist/AbstractPlaylist.cpp
+++ b/modules/demux/adaptive/playlist/AbstractPlaylist.cpp
@@ -45,6 +45,7 @@ AbstractPlaylist::AbstractPlaylist (vlc_object_t *p_object_) :
     maxSegmentDuration.Set( 0 );
     minBufferTime = 0;
     timeShiftBufferDepth.Set( 0 );
+    suggestedPresentationDelay.Set( 0 );
 }
 
 AbstractPlaylist::~AbstractPlaylist()
diff --git a/modules/demux/adaptive/playlist/AbstractPlaylist.hpp b/modules/demux/adaptive/playlist/AbstractPlaylist.hpp
index ac69107..51cf19e 100644
--- a/modules/demux/adaptive/playlist/AbstractPlaylist.hpp
+++ b/modules/demux/adaptive/playlist/AbstractPlaylist.hpp
@@ -68,6 +68,7 @@ namespace adaptive
                 Property<mtime_t>                   minUpdatePeriod;
                 Property<mtime_t>                   maxSegmentDuration;
                 Property<mtime_t>                   timeShiftBufferDepth;
+                Property<mtime_t>                   suggestedPresentationDelay;
 
             protected:
                 vlc_object_t                       *p_object;
diff --git a/modules/demux/adaptive/playlist/SegmentInformation.cpp b/modules/demux/adaptive/playlist/SegmentInformation.cpp
index 69c965f..0fdac94 100644
--- a/modules/demux/adaptive/playlist/SegmentInformation.cpp
+++ b/modules/demux/adaptive/playlist/SegmentInformation.cpp
@@ -192,11 +192,15 @@ uint64_t SegmentInformation::getLiveStartSegmentNumber(uint64_t def) const
         /* Else compute, current time and timeshiftdepth based */
         else if( mediaSegmentTemplate->duration.Get() )
         {
-            const mtime_t i_buffer_depth = getPlaylist()->timeShiftBufferDepth.Get();
+            mtime_t i_delay = getPlaylist()->suggestedPresentationDelay.Get();
+
+            if( i_delay == 0 || i_delay > getPlaylist()->timeShiftBufferDepth.Get() )
+                 i_delay = getPlaylist()->timeShiftBufferDepth.Get();
+
             const uint64_t startnumber = mediaSegmentTemplate->startNumber.Get();
             end = mediaSegmentTemplate->getCurrentLiveTemplateNumber();
 
-            const uint64_t count = timescale.ToScaled( i_buffer_depth ) / mediaSegmentTemplate->duration.Get();
+            const uint64_t count = timescale.ToScaled( i_delay ) / mediaSegmentTemplate->duration.Get();
             if( startnumber + count >= end )
                 start = startnumber;
             else
diff --git a/modules/demux/dash/mpd/IsoffMainParser.cpp b/modules/demux/dash/mpd/IsoffMainParser.cpp
index d9ed049..aa57816 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.cpp
+++ b/modules/demux/dash/mpd/IsoffMainParser.cpp
@@ -124,6 +124,10 @@ void    IsoffMainParser::parseMPDAttributes   (MPD *mpd, xml::Node *node)
     it = attr.find("timeShiftBufferDepth");
         if(it != attr.end())
             mpd->timeShiftBufferDepth.Set(IsoTime(it->second) * CLOCK_FREQ);
+
+    it = attr.find("suggestedPresentationDelay");
+    if(it != attr.end())
+        mpd->suggestedPresentationDelay.Set(IsoTime(it->second) * CLOCK_FREQ);
 }
 
 void IsoffMainParser::parsePeriods(MPD *mpd, Node *root)



More information about the vlc-commits mailing list