[vlc-commits] demux: adaptive: do not cancel current stream when already restarting

Francois Cartegnie git at videolan.org
Fri Sep 30 19:41:58 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Sep 30 16:55:01 2016 +0200| [e3e79dac353f43e932e3fb47583d6f3361410c8d] | committer: Francois Cartegnie

demux: adaptive: do not cancel current stream when already restarting

happens on switching event while we already deleted demux

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

 modules/demux/adaptive/Streams.cpp | 17 ++++++++++++-----
 modules/demux/adaptive/Streams.hpp |  1 +
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
index 2fe6462..9fca2d5 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -46,6 +46,7 @@ AbstractStream::AbstractStream(demux_t * demux_)
     disabled = false;
     discontinuity = false;
     needrestart = false;
+    inrestart = false;
     segmentTracker = NULL;
     demuxersource = NULL;
     commandsqueue = NULL;
@@ -221,22 +222,28 @@ bool AbstractStream::startDemux()
 
 bool AbstractStream::restartDemux()
 {
+    bool b_ret = true;
     if(!demuxer)
     {
-        return startDemux();
+        b_ret = startDemux();
     }
     else if(demuxer->needsRestartOnSeek())
     {
+        inrestart = true;
         /* Push all ES as recycling candidates */
         fakeesout->recycleAll();
         /* Restart with ignoring es_Del pushes to queue when terminating demux */
         commandsqueue->setDrop(true);
         demuxer->destroy();
         commandsqueue->setDrop(false);
-        return demuxer->create();
+        b_ret = demuxer->create();
+        inrestart = false;
     }
-    commandsqueue->Commit();
-    return true;
+    else
+    {
+        commandsqueue->Commit();
+    }
+    return b_ret;
 }
 
 void AbstractStream::setDisabled(bool b)
@@ -545,7 +552,7 @@ void AbstractStream::trackerEvent(const SegmentTrackerEvent &event)
             break;
 
         case SegmentTrackerEvent::SWITCHING:
-            if(demuxer && demuxer->needsRestartOnSwitch())
+            if(demuxer && demuxer->needsRestartOnSwitch() && !inrestart)
             {
                 needrestart = true;
             }
diff --git a/modules/demux/adaptive/Streams.hpp b/modules/demux/adaptive/Streams.hpp
index 964e12e..a5ffba1 100644
--- a/modules/demux/adaptive/Streams.hpp
+++ b/modules/demux/adaptive/Streams.hpp
@@ -108,6 +108,7 @@ namespace adaptive
 
         bool discontinuity;
         bool needrestart;
+        bool inrestart;
 
         demux_t *p_realdemux;
         StreamFormat format;



More information about the vlc-commits mailing list