[vlc-commits] demux: adaptive: use bitstream switch information
Francois Cartegnie
git at videolan.org
Thu May 9 17:19:43 CEST 2019
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Apr 25 20:40:34 2019 +0200| [bd6224562fad4d7b5f29ad79761ab278d5e58c68] | committer: Francois Cartegnie
demux: adaptive: use bitstream switch information
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bd6224562fad4d7b5f29ad79761ab278d5e58c68
---
modules/demux/adaptive/Streams.cpp | 8 ++++++--
modules/demux/adaptive/plumbing/Demuxer.cpp | 6 +++---
modules/demux/adaptive/plumbing/Demuxer.hpp | 4 ++--
modules/demux/hls/HLSStreams.cpp | 2 +-
4 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
index acff1dd360..e15892f9ce 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -26,6 +26,7 @@
#include "logic/AbstractAdaptationLogic.h"
#include "http/HTTPConnection.hpp"
#include "http/HTTPConnectionManager.h"
+#include "playlist/BaseAdaptationSet.h"
#include "playlist/BaseRepresentation.h"
#include "playlist/SegmentChunk.hpp"
#include "plumbing/SourceStream.hpp"
@@ -636,9 +637,12 @@ void AbstractStream::trackerEvent(const SegmentTrackerEvent &event)
break;
case SegmentTrackerEvent::SWITCHING:
- if(demuxer && demuxer->needsRestartOnSwitch() && !inrestart)
+ if(demuxer && !inrestart)
{
- needrestart = true;
+ if(!demuxer->bitstreamSwitchCompatible() ||
+ (event.u.switching.next &&
+ !event.u.switching.next->getAdaptationSet()->isBitSwitchable()))
+ needrestart = true;
}
break;
diff --git a/modules/demux/adaptive/plumbing/Demuxer.cpp b/modules/demux/adaptive/plumbing/Demuxer.cpp
index 7c3e5edc73..3b6772e233 100644
--- a/modules/demux/adaptive/plumbing/Demuxer.cpp
+++ b/modules/demux/adaptive/plumbing/Demuxer.cpp
@@ -51,9 +51,9 @@ bool AbstractDemuxer::alwaysStartsFromZero() const
return b_startsfromzero;
}
-bool AbstractDemuxer::needsRestartOnSwitch() const
+bool AbstractDemuxer::bitstreamSwitchCompatible() const
{
- return !b_candetectswitches;
+ return b_candetectswitches;
}
bool AbstractDemuxer::needsRestartOnEachSegment() const
@@ -61,7 +61,7 @@ bool AbstractDemuxer::needsRestartOnEachSegment() const
return b_alwaysrestarts;
}
-void AbstractDemuxer::setCanDetectSwitches( bool b )
+void AbstractDemuxer::setBitstreamSwitchCompatible( bool b )
{
b_candetectswitches = b;
}
diff --git a/modules/demux/adaptive/plumbing/Demuxer.hpp b/modules/demux/adaptive/plumbing/Demuxer.hpp
index bc4a507317..e838f0c19f 100644
--- a/modules/demux/adaptive/plumbing/Demuxer.hpp
+++ b/modules/demux/adaptive/plumbing/Demuxer.hpp
@@ -40,9 +40,9 @@ namespace adaptive
virtual void destroy() = 0;
bool alwaysStartsFromZero() const;
bool needsRestartOnSeek() const;
- bool needsRestartOnSwitch() const;
+ bool bitstreamSwitchCompatible() const;
bool needsRestartOnEachSegment() const;
- void setCanDetectSwitches(bool);
+ void setBitstreamSwitchCompatible(bool);
void setRestartsOnEachSegment(bool);
protected:
diff --git a/modules/demux/hls/HLSStreams.cpp b/modules/demux/hls/HLSStreams.cpp
index bbeaab0235..7d01f80b55 100644
--- a/modules/demux/hls/HLSStreams.cpp
+++ b/modules/demux/hls/HLSStreams.cpp
@@ -137,7 +137,7 @@ AbstractDemuxer *HLSStream::newDemux(demux_t *p_realdemux, const StreamFormat &f
case StreamFormat::MPEG2TS:
ret = new Demuxer(p_realdemux, "ts", out, source);
if(ret)
- ret->setCanDetectSwitches(false); /* HLS and unique PAT/PMT versions */
+ ret->setBitstreamSwitchCompatible(false); /* HLS and unique PAT/PMT versions */
break;
case StreamFormat::MP4:
More information about the vlc-commits
mailing list