[vlc-commits] demux: adaptive: add default min buffering to playlist

Francois Cartegnie git at videolan.org
Sat Jul 9 18:42:43 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jun  7 22:56:30 2016 +0200| [8ef9ad8648f8a363ab3c37a47562c13b689a5472] | committer: Francois Cartegnie

demux: adaptive: add default min buffering to playlist

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

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

diff --git a/modules/demux/adaptive/playlist/AbstractPlaylist.cpp b/modules/demux/adaptive/playlist/AbstractPlaylist.cpp
index 9912b52..d30d847 100644
--- a/modules/demux/adaptive/playlist/AbstractPlaylist.cpp
+++ b/modules/demux/adaptive/playlist/AbstractPlaylist.cpp
@@ -41,7 +41,7 @@ AbstractPlaylist::AbstractPlaylist (vlc_object_t *p_object_) :
     duration.Set( 0 );
     minUpdatePeriod.Set( 2 * CLOCK_FREQ );
     maxSegmentDuration.Set( 0 );
-    minBufferTime.Set( 0 );
+    minBufferTime = 0;
     timeShiftBufferDepth.Set( 0 );
 }
 
@@ -76,6 +76,16 @@ void AbstractPlaylist::setType(const std::string &type_)
     type = type_;
 }
 
+void AbstractPlaylist::setMinBuffering( mtime_t min )
+{
+    minBufferTime = min;
+}
+
+mtime_t AbstractPlaylist::getMinBuffering() const
+{
+    return std::max(minBufferTime, 6*CLOCK_FREQ);
+}
+
 Url AbstractPlaylist::getUrlSegment() const
 {
     Url ret;
diff --git a/modules/demux/adaptive/playlist/AbstractPlaylist.hpp b/modules/demux/adaptive/playlist/AbstractPlaylist.hpp
index dc813e7..35fdb22 100644
--- a/modules/demux/adaptive/playlist/AbstractPlaylist.hpp
+++ b/modules/demux/adaptive/playlist/AbstractPlaylist.hpp
@@ -42,6 +42,8 @@ namespace adaptive
 
                 virtual bool                    isLive() const = 0;
                 void                            setType(const std::string &);
+                void                            setMinBuffering( mtime_t );
+                mtime_t                         getMinBuffering() const;
                 virtual void                    debug() = 0;
 
                 void    addPeriod               (BasePeriod *period);
@@ -64,7 +66,6 @@ namespace adaptive
                 Property<time_t>                    availabilityStartTime;
                 Property<mtime_t>                   minUpdatePeriod;
                 Property<mtime_t>                   maxSegmentDuration;
-                Property<mtime_t>                   minBufferTime;
                 Property<mtime_t>                   timeShiftBufferDepth;
 
             protected:
@@ -73,7 +74,7 @@ namespace adaptive
                 std::vector<std::string>            baseUrls;
                 std::string                         playlistUrl;
                 std::string                         type;
-
+                mtime_t                             minBufferTime;
         };
     }
 }
diff --git a/modules/demux/dash/mpd/IsoffMainParser.cpp b/modules/demux/dash/mpd/IsoffMainParser.cpp
index 5f48a37..db38f78 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.cpp
+++ b/modules/demux/dash/mpd/IsoffMainParser.cpp
@@ -99,7 +99,7 @@ void    IsoffMainParser::parseMPDAttributes   (MPD *mpd, xml::Node *node)
 
     it = attr.find("minBufferTime");
     if(it != attr.end())
-        mpd->minBufferTime.Set(IsoTime(it->second) * CLOCK_FREQ);
+        mpd->setMinBuffering(IsoTime(it->second) * CLOCK_FREQ);
 
     it = attr.find("minimumUpdatePeriod");
     if(it != attr.end())
diff --git a/modules/demux/dash/mpd/MPD.cpp b/modules/demux/dash/mpd/MPD.cpp
index 976b82e..16ec834 100644
--- a/modules/demux/dash/mpd/MPD.cpp
+++ b/modules/demux/dash/mpd/MPD.cpp
@@ -89,7 +89,7 @@ void MPD::debug()
             " minBufferTime=%" PRId64,
             static_cast<std::string>(getProfile()).c_str(),
             duration.Get() / CLOCK_FREQ,
-            minBufferTime.Get());
+            minBufferTime);
     msg_Dbg(p_object, "BaseUrl=%s", getUrlSegment().toString().c_str());
 
     std::vector<BasePeriod *>::const_iterator i;



More information about the vlc-commits mailing list