Commit 91f528c9 authored by François Cartegnie's avatar François Cartegnie 🤞

demux: adaptive: set demux time offset to segment start, not seek time

otherwise creates out of sync multiple streams with mp4
parent b63d70ee
......@@ -250,6 +250,7 @@ AbstractStream::status AbstractStream::demux(mtime_t nz_deadline, bool send)
dead = true; /* Prevent further retries */
return AbstractStream::status_eof;
}
setTimeOffset();
}
if(nz_deadline + VLC_TS_0 > getBufferingLevel()) /* not already demuxed */
......@@ -351,10 +352,7 @@ bool AbstractStream::setPosition(mtime_t time, bool tryonly)
if( !restartDemux() )
dead = true;
/* Check if we need to set an offset as the demuxer
* will start from zero from seek point */
if(demuxer->alwaysStartsFromZero())
fakeesout->setTimestampOffset(time);
setTimeOffset();
}
pcr = VLC_TS_INVALID;
......@@ -383,6 +381,16 @@ void AbstractStream::fillExtraFMTInfo( es_format_t *p_fmt ) const
p_fmt->psz_description = strdup(description.c_str());
}
void AbstractStream::setTimeOffset()
{
/* Check if we need to set an offset as the demuxer
* will start from zero from seek point */
if(demuxer && demuxer->alwaysStartsFromZero())
fakeesout->setTimestampOffset(segmentTracker->getPlaybackTime());
else
fakeesout->setTimestampOffset(0);
}
void AbstractStream::trackerEvent(const SegmentTrackerEvent &event)
{
switch(event.type)
......
......@@ -86,6 +86,7 @@ namespace adaptive
protected:
bool seekAble() const;
virtual void setTimeOffset();
virtual block_t *checkBlock(block_t *, bool) = 0;
virtual AbstractDemuxer * createDemux(const StreamFormat &) = 0;
virtual bool startDemux();
......
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