[vlc-commits] demux: adaptive: allow to override max buffering

Francois Cartegnie git at videolan.org
Tue Mar 17 12:42:27 CET 2020


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Feb 13 19:22:11 2020 +0100| [fa8c8eac8b2acd00c24928b9b03c963717a97fed] | committer: Francois Cartegnie

demux: adaptive: allow to override max buffering

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

 modules/demux/adaptive/playlist/AbstractPlaylist.cpp | 9 ++++++++-
 modules/demux/adaptive/playlist/AbstractPlaylist.hpp | 2 ++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/modules/demux/adaptive/playlist/AbstractPlaylist.cpp b/modules/demux/adaptive/playlist/AbstractPlaylist.cpp
index 68ddecad06..43b98f9d69 100644
--- a/modules/demux/adaptive/playlist/AbstractPlaylist.cpp
+++ b/modules/demux/adaptive/playlist/AbstractPlaylist.cpp
@@ -44,6 +44,7 @@ AbstractPlaylist::AbstractPlaylist (vlc_object_t *p_object_) :
     minUpdatePeriod.Set( VLC_TICK_FROM_SEC(2) );
     maxSegmentDuration.Set( 0 );
     minBufferTime = 0;
+    maxBufferTime = 0;
     timeShiftBufferDepth.Set( 0 );
     suggestedPresentationDelay.Set( 0 );
     b_needsUpdates = true;
@@ -85,6 +86,11 @@ void AbstractPlaylist::setMinBuffering( vlc_tick_t min )
     minBufferTime = min;
 }
 
+void AbstractPlaylist::setMaxBuffering( vlc_tick_t max )
+{
+    maxBufferTime = max;
+}
+
 vlc_tick_t AbstractPlaylist::getMinBuffering() const
 {
     return std::max(minBufferTime, VLC_TICK_FROM_SEC(6));
@@ -93,7 +99,8 @@ vlc_tick_t AbstractPlaylist::getMinBuffering() const
 vlc_tick_t AbstractPlaylist::getMaxBuffering() const
 {
     const vlc_tick_t minbuf = getMinBuffering();
-    return std::max(minbuf, VLC_TICK_FROM_SEC(60));
+    const vlc_tick_t maxbuf = maxBufferTime ? maxBufferTime : VLC_TICK_FROM_SEC(60);
+    return std::max(minbuf, maxbuf);
 }
 
 Url AbstractPlaylist::getUrlSegment() const
diff --git a/modules/demux/adaptive/playlist/AbstractPlaylist.hpp b/modules/demux/adaptive/playlist/AbstractPlaylist.hpp
index d9e22e4812..45d2b1f98f 100644
--- a/modules/demux/adaptive/playlist/AbstractPlaylist.hpp
+++ b/modules/demux/adaptive/playlist/AbstractPlaylist.hpp
@@ -43,6 +43,7 @@ namespace adaptive
                 virtual bool                    isLive() const = 0;
                 void                            setType(const std::string &);
                 void                            setMinBuffering( vlc_tick_t );
+                void                            setMaxBuffering( vlc_tick_t );
                 vlc_tick_t                      getMinBuffering() const;
                 vlc_tick_t                      getMaxBuffering() const;
                 virtual void                    debug() = 0;
@@ -77,6 +78,7 @@ namespace adaptive
                 std::string                         playlistUrl;
                 std::string                         type;
                 vlc_tick_t                          minBufferTime;
+                vlc_tick_t                          maxBufferTime;
                 bool                                b_needsUpdates;
         };
     }



More information about the vlc-commits mailing list