[vlc-commits] demux: adaptive: set demux time offset to segment start, not seek time
Francois Cartegnie
git at videolan.org
Fri Jun 10 16:07:23 CEST 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jun 9 11:44:55 2016 +0200| [91f528c97fad2400a42ba8af02f5fde2fc1a36f9] | committer: Francois Cartegnie
demux: adaptive: set demux time offset to segment start, not seek time
otherwise creates out of sync multiple streams with mp4
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=91f528c97fad2400a42ba8af02f5fde2fc1a36f9
---
modules/demux/adaptive/Streams.cpp | 16 ++++++++++++----
modules/demux/adaptive/Streams.hpp | 1 +
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
index d05dd15..2e98da9 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -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)
diff --git a/modules/demux/adaptive/Streams.hpp b/modules/demux/adaptive/Streams.hpp
index 6fa20ea..696d0b1 100644
--- a/modules/demux/adaptive/Streams.hpp
+++ b/modules/demux/adaptive/Streams.hpp
@@ -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();
More information about the vlc-commits
mailing list