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