[vlc-commits] demux: adaptive: ignore explicit discontinuities on seek/start

Francois Cartegnie git at videolan.org
Mon Mar 30 16:16:01 CEST 2020


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Jun 23 22:15:12 2019 +0200| [0d742fa461fc90c1572e1335f4b8b92d1f91b017] | committer: Francois Cartegnie

demux: adaptive: ignore explicit discontinuities on seek/start

(cherry picked from commit 7ee46b35512501d7a81ee6e9082717a30c007a1f)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=0d742fa461fc90c1572e1335f4b8b92d1f91b017
---

 modules/demux/adaptive/Streams.cpp | 11 +++++++++++
 modules/demux/adaptive/Streams.hpp |  1 +
 2 files changed, 12 insertions(+)

diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
index 750d7beca1..daa888116c 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -51,6 +51,7 @@ AbstractStream::AbstractStream(demux_t * demux_)
     discontinuity = false;
     needrestart = false;
     inrestart = false;
+    demuxfirstchunk = false;
     segmentTracker = NULL;
     demuxersource = NULL;
     demuxer = NULL;
@@ -235,6 +236,7 @@ bool AbstractStream::startDemux()
     if(!demuxer && format != StreamFormat())
         msg_Err(p_realdemux, "Failed to create demuxer %p %s", (void *)demuxer,
                 format.str().c_str());
+    demuxfirstchunk = true;
 
     return !!demuxer;
 }
@@ -474,6 +476,12 @@ block_t * AbstractStream::readNextBlock()
     if (currentChunk == NULL && !eof)
         currentChunk = segmentTracker->getNextChunk(!fakeEsOut()->restarting(), connManager);
 
+    if(discontinuity && demuxfirstchunk)
+    {
+        /* clear up discontinuity on demux start (discontinuity on start segment bug) */
+        discontinuity = false;
+    }
+
     if(discontinuity || needrestart)
     {
         msg_Info(p_realdemux, "Encountered discontinuity");
@@ -497,6 +505,8 @@ block_t * AbstractStream::readNextBlock()
         return NULL;
     }
 
+    demuxfirstchunk = false;
+
     if (currentChunk->isEmpty())
     {
         delete currentChunk;
@@ -519,6 +529,7 @@ bool AbstractStream::setPosition(mtime_t time, bool tryonly)
     {
         // clear eof flag before restartDemux() to prevent readNextBlock() fail
         eof = false;
+        demuxfirstchunk = true;
         if(b_needs_restart)
         {
             if(currentChunk)
diff --git a/modules/demux/adaptive/Streams.hpp b/modules/demux/adaptive/Streams.hpp
index 21386eea59..9f1ecc6d37 100644
--- a/modules/demux/adaptive/Streams.hpp
+++ b/modules/demux/adaptive/Streams.hpp
@@ -116,6 +116,7 @@ namespace adaptive
         bool discontinuity;
         bool needrestart;
         bool inrestart;
+        bool demuxfirstchunk;
 
         demux_t *p_realdemux;
         StreamFormat format;



More information about the vlc-commits mailing list