Commit 7d185504 authored by Antoine Cellerier's avatar Antoine Cellerier

* add some locking the the video filter2 handling code in video output core. Fix #945 (untested)

parent f0fbcbd5
...@@ -398,6 +398,7 @@ struct vout_thread_t ...@@ -398,6 +398,7 @@ struct vout_thread_t
vlc_mutex_t picture_lock; /**< picture heap lock */ vlc_mutex_t picture_lock; /**< picture heap lock */
vlc_mutex_t subpicture_lock; /**< subpicture heap lock */ vlc_mutex_t subpicture_lock; /**< subpicture heap lock */
vlc_mutex_t change_lock; /**< thread change 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 */ vout_sys_t * p_sys; /**< system output method */
/**@}*/ /**@}*/
......
...@@ -308,6 +308,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt ) ...@@ -308,6 +308,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
/* Initialize locks */ /* Initialize locks */
vlc_mutex_init( p_vout, &p_vout->picture_lock ); 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->change_lock );
vlc_mutex_init( p_vout, &p_vout->vfilter_lock );
/* Mouse coordinates */ /* Mouse coordinates */
var_Create( p_vout, "mouse-x", VLC_VAR_INTEGER ); var_Create( p_vout, "mouse-x", VLC_VAR_INTEGER );
...@@ -942,6 +943,7 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -942,6 +943,7 @@ static void RunThread( vout_thread_t *p_vout)
if( p_vout->b_vfilter_change == VLC_TRUE ) if( p_vout->b_vfilter_change == VLC_TRUE )
{ {
int i; int i;
vlc_mutex_lock( &p_vout->vfilter_lock );
RemoveVideoFilters2( p_vout ); RemoveVideoFilters2( p_vout );
for( i = 0; i < p_vout->i_vfilters_cfg; i++ ) for( i = 0; i < p_vout->i_vfilters_cfg; i++ )
{ {
...@@ -988,6 +990,7 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -988,6 +990,7 @@ static void RunThread( vout_thread_t *p_vout)
} }
} }
p_vout->b_vfilter_change = VLC_FALSE; p_vout->b_vfilter_change = VLC_FALSE;
vlc_mutex_unlock( &p_vout->vfilter_lock );
} }
if( p_picture ) if( p_picture )
...@@ -1284,6 +1287,7 @@ static void DestroyThread( vout_thread_t *p_vout ) ...@@ -1284,6 +1287,7 @@ static void DestroyThread( vout_thread_t *p_vout )
/* Destroy the locks */ /* Destroy the locks */
vlc_mutex_destroy( &p_vout->picture_lock ); vlc_mutex_destroy( &p_vout->picture_lock );
vlc_mutex_destroy( &p_vout->change_lock ); vlc_mutex_destroy( &p_vout->change_lock );
vlc_mutex_destroy( &p_vout->vfilter_lock );
/* Release the module */ /* Release the module */
if( p_vout && p_vout->p_module ) if( p_vout && p_vout->p_module )
...@@ -1589,8 +1593,10 @@ static int VideoFilter2Callback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -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; vout_thread_t *p_vout = (vout_thread_t *)p_this;
vlc_mutex_lock( &p_vout->vfilter_lock );
ParseVideoFilter2Chain( p_vout, newval.psz_string ); ParseVideoFilter2Chain( p_vout, newval.psz_string );
p_vout->b_vfilter_change = VLC_TRUE; p_vout->b_vfilter_change = VLC_TRUE;
vlc_mutex_unlock( &p_vout->vfilter_lock );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment