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

demux: hls: workaround missing/invalid extinf duration

as vimeo can't properly write extinf
parent 00c6ac90
......@@ -238,26 +238,25 @@ void M3U8Parser::parseSegments(vlc_object_t *, Representation *rep, const std::l
if((unsigned)rep->getStreamFormat() == StreamFormat::UNKNOWN)
setFormatFromExtension(rep, uritag->getValue().value);
/* Need to use EXTXTARGETDURATION as default as some can't properly set segment one */
double duration = rep->targetDuration;
if(ctx_extinf)
{
const Attribute *attribute = ctx_extinf->getAttributeByName("DURATION");
if(attribute)
{
const double duration = attribute->floatingPoint();
const Attribute *durAttribute = ctx_extinf->getAttributeByName("DURATION");
if(durAttribute)
duration = durAttribute->floatingPoint();
ctx_extinf = NULL;
}
const mtime_t nzDuration = CLOCK_FREQ * duration;
segment->duration.Set(duration * (uint64_t) rep->getTimescale());
segment->startTime.Set(rep->getTimescale().ToScaled(nzStartTime));
nzStartTime += nzDuration;
totalduration += nzDuration;
if(absReferenceTime > VLC_TS_INVALID)
{
segment->utcTime = absReferenceTime;
absReferenceTime += nzDuration;
}
}
ctx_extinf = NULL;
}
segmentList->addSegment(segment);
......
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