[vlc-commits] demux: adaptive: allow to override max buffering
Francois Cartegnie
git at videolan.org
Mon Mar 30 16:16:41 CEST 2020
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Feb 13 19:22:11 2020 +0100| [75c865f9cd2c607b3cab2967b43f8473cf922ff0] | committer: Francois Cartegnie
demux: adaptive: allow to override max buffering
(cherry picked from commit fa8c8eac8b2acd00c24928b9b03c963717a97fed)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=75c865f9cd2c607b3cab2967b43f8473cf922ff0
---
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 50d80b54c8..e551748086 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( 2 * CLOCK_FREQ );
maxSegmentDuration.Set( 0 );
minBufferTime = 0;
+ maxBufferTime = 0;
timeShiftBufferDepth.Set( 0 );
suggestedPresentationDelay.Set( 0 );
b_needsUpdates = true;
@@ -85,6 +86,11 @@ void AbstractPlaylist::setMinBuffering( mtime_t min )
minBufferTime = min;
}
+void AbstractPlaylist::setMaxBuffering( mtime_t max )
+{
+ maxBufferTime = max;
+}
+
mtime_t AbstractPlaylist::getMinBuffering() const
{
return std::max(minBufferTime, 6*CLOCK_FREQ);
@@ -93,7 +99,8 @@ mtime_t AbstractPlaylist::getMinBuffering() const
mtime_t AbstractPlaylist::getMaxBuffering() const
{
const mtime_t minbuf = getMinBuffering();
- return std::max(minbuf, 60 * CLOCK_FREQ);
+ const mtime_t maxbuf = maxBufferTime ? maxBufferTime : CLOCK_FREQ * 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 3a822e2aef..11d9933456 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( mtime_t );
+ void setMaxBuffering( mtime_t );
mtime_t getMinBuffering() const;
mtime_t getMaxBuffering() const;
virtual void debug() = 0;
@@ -77,6 +78,7 @@ namespace adaptive
std::string playlistUrl;
std::string type;
mtime_t minBufferTime;
+ mtime_t maxBufferTime;
bool b_needsUpdates;
};
}
More information about the vlc-commits
mailing list