Commit 22d7d975 authored by François Cartegnie's avatar François Cartegnie 🤞

demux: adaptative: add setPosition by segment number

parent b40ef139
......@@ -133,28 +133,31 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed)
return chunk;
}
bool SegmentTracker::setPosition(mtime_t time, bool restarted, bool tryonly)
bool SegmentTracker::setPositionByTime(mtime_t time, bool restarted, bool tryonly)
{
uint64_t segnumber;
if(prevRepresentation &&
prevRepresentation->getSegmentNumberByTime(time, &segnumber))
{
if(!tryonly)
{
if(restarted)
{
initializing = true;
index_sent = false;
init_sent = false;
}
count = segnumber;
sequence_set = true;
}
setPositionByNumber(segnumber, restarted);
return true;
}
return false;
}
void SegmentTracker::setPositionByNumber(uint64_t segnumber, bool restarted)
{
if(restarted)
{
initializing = true;
index_sent = false;
init_sent = false;
}
count = segnumber;
sequence_set = true;
}
mtime_t SegmentTracker::getSegmentStart() const
{
if(prevRepresentation && sequence_set)
......
......@@ -287,7 +287,7 @@ bool Stream::setPosition(mtime_t time, bool tryonly)
if(!output)
return false;
bool ret = segmentTracker->setPosition(time, output->reinitsOnSeek(), tryonly);
bool ret = segmentTracker->setPositionByTime(time, output->reinitsOnSeek(), tryonly);
if(!tryonly && ret)
{
output->setPosition(time);
......
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