[vlc-commits] demux: adaptive: add always restart demuxers for webvtt

Francois Cartegnie git at videolan.org
Thu Nov 9 17:07:17 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Nov  9 15:07:46 2017 +0100| [4dd676f94a9adc6ed518ca64c6202a472c51a5c9] | committer: Francois Cartegnie

demux: adaptive: add always restart demuxers for webvtt

because we really can't feed getLine's 2K peeks.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4dd676f94a9adc6ed518ca64c6202a472c51a5c9
---

 modules/demux/adaptive/Streams.cpp          |  9 +++++++++
 modules/demux/adaptive/plumbing/Demuxer.cpp | 10 ++++++++++
 modules/demux/adaptive/plumbing/Demuxer.hpp |  3 +++
 modules/demux/hls/HLSStreams.cpp            |  2 ++
 4 files changed, 24 insertions(+)

diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
index baef7e4534..ecb3efc68b 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -588,6 +588,15 @@ void AbstractStream::trackerEvent(const SegmentTrackerEvent &event)
             {
                 needrestart = true;
             }
+            break;
+
+        case SegmentTrackerEvent::SEGMENT_CHANGE:
+            if(demuxer && demuxer->needsRestartOnEachSegment() && !inrestart)
+            {
+                needrestart = true;
+            }
+            break;
+
         default:
             break;
     }
diff --git a/modules/demux/adaptive/plumbing/Demuxer.cpp b/modules/demux/adaptive/plumbing/Demuxer.cpp
index 3fe9921266..648d15d311 100644
--- a/modules/demux/adaptive/plumbing/Demuxer.cpp
+++ b/modules/demux/adaptive/plumbing/Demuxer.cpp
@@ -54,11 +54,21 @@ bool AbstractDemuxer::needsRestartOnSwitch() const
     return !b_candetectswitches;
 }
 
+bool AbstractDemuxer::needsRestartOnEachSegment() const
+{
+    return b_alwaysrestarts;
+}
+
 void AbstractDemuxer::setCanDetectSwitches( bool b )
 {
     b_candetectswitches = b;
 }
 
+void AbstractDemuxer::setRestartsOnEachSegment( bool b )
+{
+    b_alwaysrestarts = b;
+}
+
 bool AbstractDemuxer::needsRestartOnSeek() const
 {
     return b_reinitsonseek;
diff --git a/modules/demux/adaptive/plumbing/Demuxer.hpp b/modules/demux/adaptive/plumbing/Demuxer.hpp
index 6b62a27834..3e9b8b9182 100644
--- a/modules/demux/adaptive/plumbing/Demuxer.hpp
+++ b/modules/demux/adaptive/plumbing/Demuxer.hpp
@@ -39,11 +39,14 @@ namespace adaptive
             bool alwaysStartsFromZero() const;
             bool needsRestartOnSeek() const;
             bool needsRestartOnSwitch() const;
+            bool needsRestartOnEachSegment() const;
             void setCanDetectSwitches(bool);
+            void setRestartsOnEachSegment(bool);
 
         protected:
             bool b_startsfromzero;
             bool b_reinitsonseek;
+            bool b_alwaysrestarts;
             bool b_candetectswitches;
     };
 
diff --git a/modules/demux/hls/HLSStreams.cpp b/modules/demux/hls/HLSStreams.cpp
index b88aeb939f..c54c7fee27 100644
--- a/modules/demux/hls/HLSStreams.cpp
+++ b/modules/demux/hls/HLSStreams.cpp
@@ -89,6 +89,8 @@ AbstractDemuxer * HLSStream::createDemux(const StreamFormat &format)
 
         case StreamFormat::WEBVTT:
             ret = new Demuxer(p_realdemux, "webvttstream", fakeesout->getEsOut(), demuxersource);
+            if(ret)
+                ret->setRestartsOnEachSegment(true);
             break;
 
         default:



More information about the vlc-commits mailing list