Commit 7b5bff3d authored by François Cartegnie's avatar François Cartegnie 🤞

demux: adaptative: fix unsupported format regression

Due to hls we we waiting for demuxer to start, which would
load the demuxer source (sub playlist then) and from that
file we would have the format and change the demux if
required.

The problem is that any unsupported format (like split subtitles)
is now being to be demuxed and gets probed and demuxed.
parent 7661da70
......@@ -72,6 +72,16 @@ void SegmentTracker::setAdaptationLogic(AbstractAdaptationLogic *logic_)
registerListener(logic);
}
StreamFormat SegmentTracker::initialFormat() const
{
BaseRepresentation *rep = curRepresentation;
if(!rep)
rep = logic->getNextRepresentation(adaptationSet, NULL);
if(rep)
return rep->getStreamFormat();
return StreamFormat();
}
bool SegmentTracker::segmentsListReady() const
{
BaseRepresentation *rep = curRepresentation;
......
......@@ -95,6 +95,7 @@ namespace adaptative
~SegmentTracker();
void setAdaptationLogic(AbstractAdaptationLogic *);
StreamFormat initialFormat() const;
bool segmentsListReady() const;
void reset();
SegmentChunk* getNextChunk(bool, HTTPConnectionManager *);
......
......@@ -40,6 +40,8 @@ std::string StreamFormat::str() const
return "Timed Text";
case PACKEDAAC:
return "Packed AAC";
case UNSUPPORTED:
return "Unsupported";
default:
case UNKNOWN:
return "Unknown";
......
......@@ -228,19 +228,23 @@ AbstractStream::status AbstractStream::demux(mtime_t nz_deadline, bool send)
return AbstractStream::status_dis;
}
if(!demuxer && !startDemux())
if(!demuxer)
{
/* If demux fails because of probing failure / wrong format*/
if(discontinuity)
format = segmentTracker->initialFormat();
if(!startDemux())
{
msg_Dbg( p_realdemux, "Flushing on format change" );
prepareFormatChange();
discontinuity = false;
flushing = true;
return AbstractStream::status_buffering;
/* If demux fails because of probing failure / wrong format*/
if(discontinuity)
{
msg_Dbg( p_realdemux, "Flushing on format change" );
prepareFormatChange();
discontinuity = false;
flushing = true;
return AbstractStream::status_buffering;
}
dead = true; /* Prevent further retries */
return AbstractStream::status_eof;
}
dead = true; /* Prevent further retries */
return AbstractStream::status_eof;
}
if(nz_deadline + VLC_TS_0 > getBufferingLevel()) /* not already demuxed */
......
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