[vlc-commits] demux: adaptative: ensure data is dropped while restarting

Francois Cartegnie git at videolan.org
Thu Jun 18 17:32:48 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jun 18 16:18:43 2015 +0200| [0a6a4489f1bdec209322a469569df7008085c04c] | committer: Francois Cartegnie

demux: adaptative: ensure data is dropped while restarting

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

 modules/demux/adaptative/Streams.cpp |   32 ++++++++++++++++++++++++--------
 modules/demux/adaptative/Streams.hpp |    1 +
 2 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/modules/demux/adaptative/Streams.cpp b/modules/demux/adaptative/Streams.cpp
index c786e65..4cdb18e 100644
--- a/modules/demux/adaptative/Streams.cpp
+++ b/modules/demux/adaptative/Streams.cpp
@@ -287,6 +287,7 @@ BaseStreamOutput::BaseStreamOutput(demux_t *demux, const std::string &name) :
     seekable = true;
     restarting = false;
     demuxstream = NULL;
+    b_drop = false;
 
     fakeesout = new es_out_t;
     if (!fakeesout)
@@ -370,12 +371,20 @@ void BaseStreamOutput::setPosition(mtime_t nztime)
         if(pair->p_queue && pair->p_queue->i_dts > VLC_TS_0 + nztime)
             pair->drop();
     }
+    /* disable appending until restarted */
+    b_drop = true;
+    vlc_mutex_unlock(&lock);
+
+    if(reinitsOnSeek())
+        restart();
+
+    vlc_mutex_lock(&lock);
+    b_drop = false;
     pcr = VLC_TS_INVALID;
     vlc_mutex_unlock(&lock);
+
     es_out_Control(realdemux->out, ES_OUT_SET_NEXT_DISPLAY_TIME,
                    VLC_TS_0 + nztime);
-    if(reinitsOnSeek())
-        restart();
 }
 
 bool BaseStreamOutput::restart()
@@ -516,14 +525,21 @@ int BaseStreamOutput::esOutSend(es_out_t *fakees, es_out_id_t *p_es, block_t *p_
 {
     BaseStreamOutput *me = (BaseStreamOutput *) fakees->p_sys;
     vlc_mutex_lock(&me->lock);
-    std::list<Demuxed *>::const_iterator it;
-    for(it=me->queues.begin(); it!=me->queues.end();++it)
+    if(me->b_drop)
     {
-        Demuxed *pair = *it;
-        if(pair->es_id == p_es)
+        block_ChainRelease( p_block );
+    }
+    else
+    {
+        std::list<Demuxed *>::const_iterator it;
+        for(it=me->queues.begin(); it!=me->queues.end();++it)
         {
-            block_ChainLastAppend(&pair->pp_queue_last, p_block);
-            break;
+            Demuxed *pair = *it;
+            if(pair->es_id == p_es)
+            {
+                block_ChainLastAppend(&pair->pp_queue_last, p_block);
+                break;
+            }
         }
     }
     vlc_mutex_unlock(&me->lock);
diff --git a/modules/demux/adaptative/Streams.hpp b/modules/demux/adaptative/Streams.hpp
index da0e5b5..9e0c589 100644
--- a/modules/demux/adaptative/Streams.hpp
+++ b/modules/demux/adaptative/Streams.hpp
@@ -164,6 +164,7 @@ namespace adaptative
             es_format_t fmtcpy;
         };
         std::list<Demuxed *> queues;
+        bool b_drop;
         vlc_mutex_t lock;
         void sendToDecoderUnlocked(mtime_t);
         bool restart();



More information about the vlc-commits mailing list