* add some locking the the video filter2 handling code in video output core. Fix...
authorAntoine Cellerier <dionoea@videolan.org>
Mon, 25 Dec 2006 22:28:45 +0000 (22:28 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Mon, 25 Dec 2006 22:28:45 +0000 (22:28 +0000)
include/vlc_vout.h
src/video_output/video_output.c

index 23ea5e7..baa6b1e 100644 (file)
@@ -398,6 +398,7 @@ struct vout_thread_t
     vlc_mutex_t         picture_lock;                 /**< picture heap lock */
     vlc_mutex_t         subpicture_lock;           /**< subpicture heap lock */
     vlc_mutex_t         change_lock;                 /**< thread change lock */
+    vlc_mutex_t         vfilter_lock;         /**< video filter2 change lock */
     vout_sys_t *        p_sys;                     /**< system output method */
     /**@}*/
 
index bdbf603..bb6b2a4 100644 (file)
@@ -308,6 +308,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
     /* Initialize locks */
     vlc_mutex_init( p_vout, &p_vout->picture_lock );
     vlc_mutex_init( p_vout, &p_vout->change_lock );
+    vlc_mutex_init( p_vout, &p_vout->vfilter_lock );
 
     /* Mouse coordinates */
     var_Create( p_vout, "mouse-x", VLC_VAR_INTEGER );
@@ -942,6 +943,7 @@ static void RunThread( vout_thread_t *p_vout)
         if( p_vout->b_vfilter_change == VLC_TRUE )
         {
             int i;
+            vlc_mutex_lock( &p_vout->vfilter_lock );
             RemoveVideoFilters2( p_vout );
             for( i = 0; i < p_vout->i_vfilters_cfg; i++ )
             {
@@ -988,6 +990,7 @@ static void RunThread( vout_thread_t *p_vout)
                 }
             }
             p_vout->b_vfilter_change = VLC_FALSE;
+            vlc_mutex_unlock( &p_vout->vfilter_lock );
         }
 
         if( p_picture )
@@ -1284,6 +1287,7 @@ static void DestroyThread( vout_thread_t *p_vout )
     /* Destroy the locks */
     vlc_mutex_destroy( &p_vout->picture_lock );
     vlc_mutex_destroy( &p_vout->change_lock );
+    vlc_mutex_destroy( &p_vout->vfilter_lock );
 
     /* Release the module */
     if( p_vout && p_vout->p_module )
@@ -1589,8 +1593,10 @@ static int VideoFilter2Callback( vlc_object_t *p_this, char const *psz_cmd,
 {
     vout_thread_t *p_vout = (vout_thread_t *)p_this;
 
+    vlc_mutex_lock( &p_vout->vfilter_lock );
     ParseVideoFilter2Chain( p_vout, newval.psz_string );
     p_vout->b_vfilter_change = VLC_TRUE;
+    vlc_mutex_unlock( &p_vout->vfilter_lock );
 
     return VLC_SUCCESS;
 }