Commit 8ef9ad86 authored by François Cartegnie's avatar François Cartegnie 🤞

demux: adaptive: add default min buffering to playlist

parent e1fe5801
......@@ -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;
......
......@@ -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;
};
}
}
......
......@@ -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())
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment