[vlc-commits] demux: adaptative: add missing locks in controls callback

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:32:01 2015 +0200| [2057a8fd1c8d4c11252d88db5985ba42f967be71] | committer: Francois Cartegnie

demux: adaptative: add missing locks in controls callback

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

 modules/demux/adaptative/Streams.cpp |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/modules/demux/adaptative/Streams.cpp b/modules/demux/adaptative/Streams.cpp
index 4cdb18e..77ae5b4 100644
--- a/modules/demux/adaptative/Streams.cpp
+++ b/modules/demux/adaptative/Streams.cpp
@@ -584,13 +584,17 @@ int BaseStreamOutput::esOutControl(es_out_t *fakees, int i_query, va_list args)
     BaseStreamOutput *me = (BaseStreamOutput *) fakees->p_sys;
     if (i_query == ES_OUT_SET_PCR )
     {
+        vlc_mutex_lock(&me->lock);
         me->pcr = (int64_t)va_arg( args, int64_t );
+        vlc_mutex_unlock(&me->lock);
         return VLC_SUCCESS;
     }
     else if( i_query == ES_OUT_SET_GROUP_PCR )
     {
+        vlc_mutex_lock(&me->lock);
         me->group = (int) va_arg( args, int );
         me->pcr = (int64_t)va_arg( args, int64_t );
+        vlc_mutex_unlock(&me->lock);
         return VLC_SUCCESS;
     }
     else if( i_query == ES_OUT_GET_ES_STATE )
@@ -600,7 +604,12 @@ int BaseStreamOutput::esOutControl(es_out_t *fakees, int i_query, va_list args)
         *pb = true;
         return VLC_SUCCESS;
     }
-    else if( me->restarting )
+
+    vlc_mutex_lock(&me->lock);
+    bool b_restarting = me->restarting;
+    vlc_mutex_unlock(&me->lock);
+
+    if( b_restarting )
     {
         return VLC_EGENERIC;
     }



More information about the vlc-commits mailing list