Commit e3e79dac authored by François Cartegnie's avatar François Cartegnie 🤞

demux: adaptive: do not cancel current stream when already restarting

happens on switching event while we already deleted demux
parent f96eda25
......@@ -46,6 +46,7 @@ AbstractStream::AbstractStream(demux_t * demux_)
disabled = false;
discontinuity = false;
needrestart = false;
inrestart = false;
segmentTracker = NULL;
demuxersource = NULL;
commandsqueue = NULL;
......@@ -221,22 +222,28 @@ bool AbstractStream::startDemux()
bool AbstractStream::restartDemux()
{
bool b_ret = true;
if(!demuxer)
{
return startDemux();
b_ret = startDemux();
}
else if(demuxer->needsRestartOnSeek())
{
inrestart = true;
/* Push all ES as recycling candidates */
fakeesout->recycleAll();
/* Restart with ignoring es_Del pushes to queue when terminating demux */
commandsqueue->setDrop(true);
demuxer->destroy();
commandsqueue->setDrop(false);
return demuxer->create();
b_ret = demuxer->create();
inrestart = false;
}
commandsqueue->Commit();
return true;
else
{
commandsqueue->Commit();
}
return b_ret;
}
void AbstractStream::setDisabled(bool b)
......@@ -545,7 +552,7 @@ void AbstractStream::trackerEvent(const SegmentTrackerEvent &event)
break;
case SegmentTrackerEvent::SWITCHING:
if(demuxer && demuxer->needsRestartOnSwitch())
if(demuxer && demuxer->needsRestartOnSwitch() && !inrestart)
{
needrestart = true;
}
......
......@@ -108,6 +108,7 @@ namespace adaptive
bool discontinuity;
bool needrestart;
bool inrestart;
demux_t *p_realdemux;
StreamFormat format;
......
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