Commit 08c74d0b authored by François Cartegnie's avatar François Cartegnie 🤞

demux: adaptive: add demuxer flag for restart on switch

parent daff83c6
......@@ -223,7 +223,7 @@ bool AbstractStream::restartDemux()
{
return startDemux();
}
else if(demuxer->reinitsOnSeek())
else if(demuxer->needsRestartOnSeek())
{
/* Push all ES as recycling candidates */
fakeesout->recycleAll();
......@@ -427,10 +427,10 @@ bool AbstractStream::setPosition(mtime_t time, bool tryonly)
if(!seekAble())
return false;
bool ret = segmentTracker->setPositionByTime(time, demuxer->reinitsOnSeek(), tryonly);
bool ret = segmentTracker->setPositionByTime(time, demuxer->needsRestartOnSeek(), tryonly);
if(!tryonly && ret)
{
if(demuxer->reinitsOnSeek())
if(demuxer->needsRestartOnSeek())
{
if(currentChunk)
delete currentChunk;
......
......@@ -35,7 +35,8 @@ using namespace adaptive;
AbstractDemuxer::AbstractDemuxer()
{
b_startsfromzero = false;
b_reinitsonseek =true;
b_reinitsonseek = true;
b_candetectswitches = true;
}
AbstractDemuxer::~AbstractDemuxer()
......@@ -48,7 +49,17 @@ bool AbstractDemuxer::alwaysStartsFromZero() const
return b_startsfromzero;
}
bool AbstractDemuxer::reinitsOnSeek() const
bool AbstractDemuxer::needsRestartOnSwitch() const
{
return !b_candetectswitches;
}
void AbstractDemuxer::setCanDetectSwitches( bool b )
{
b_candetectswitches = b;
}
bool AbstractDemuxer::needsRestartOnSeek() const
{
return b_reinitsonseek;
}
......
......@@ -38,11 +38,14 @@ namespace adaptive
virtual bool create() = 0;
virtual bool restart(CommandsQueue *) = 0;
bool alwaysStartsFromZero() const;
bool reinitsOnSeek() const;
bool needsRestartOnSeek() const;
bool needsRestartOnSwitch() const;
void setCanDetectSwitches(bool);
protected:
bool b_startsfromzero;
bool b_reinitsonseek;
bool b_candetectswitches;
};
class Demuxer : public AbstractDemuxer
......
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