[vlc-commits] demux: adaptative: fix double lock on flush

Francois Cartegnie git at videolan.org
Tue May 12 18:28:58 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue May 12 18:23:57 2015 +0200| [381b34a56e0bf8e8f554f21ee781928e80c55c8f] | committer: Francois Cartegnie

demux: adaptative: fix double lock on flush

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

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

diff --git a/modules/demux/adaptative/Streams.cpp b/modules/demux/adaptative/Streams.cpp
index e0a8af5..3570b2f 100644
--- a/modules/demux/adaptative/Streams.cpp
+++ b/modules/demux/adaptative/Streams.cpp
@@ -327,6 +327,12 @@ void AbstractStreamOutput::setPosition(mtime_t nztime)
 void AbstractStreamOutput::sendToDecoder(mtime_t nzdeadline)
 {
     vlc_mutex_lock(&lock);
+    sendToDecoderUnlocked(nzdeadline);
+    vlc_mutex_unlock(&lock);
+}
+
+void AbstractStreamOutput::sendToDecoderUnlocked(mtime_t nzdeadline)
+{
     std::list<Demuxed *>::const_iterator it;
     for(it=queues.begin(); it!=queues.end();++it)
     {
@@ -343,7 +349,6 @@ void AbstractStreamOutput::sendToDecoder(mtime_t nzdeadline)
             realdemux->out->pf_send(realdemux->out, pair->es_id, p_block);
         }
     }
-    vlc_mutex_unlock(&lock);
 }
 
 AbstractStreamOutput::Demuxed::Demuxed()
@@ -411,7 +416,7 @@ void AbstractStreamOutput::esOutDel(es_out_t *fakees, es_out_id_t *p_es)
     {
         if((*it)->es_id == p_es)
         {
-            me->sendToDecoder(INT64_MAX - VLC_TS_0);
+            me->sendToDecoderUnlocked(INT64_MAX - VLC_TS_0);
             delete *it;
             me->queues.erase(it);
             break;
diff --git a/modules/demux/adaptative/Streams.hpp b/modules/demux/adaptative/Streams.hpp
index 59e6428..370976e 100644
--- a/modules/demux/adaptative/Streams.hpp
+++ b/modules/demux/adaptative/Streams.hpp
@@ -124,6 +124,7 @@ namespace adaptative
         };
         std::list<Demuxed *> queues;
         vlc_mutex_t lock;
+        void sendToDecoderUnlocked(mtime_t);
     };
 
     class MP4StreamOutput : public AbstractStreamOutput



More information about the vlc-commits mailing list