Commit 404b15a6 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

postproc: reduce lock contention in callback

parent cfad00bf
...@@ -331,28 +331,27 @@ static void PPChangeMode( filter_t *p_filter, const char *psz_name, ...@@ -331,28 +331,27 @@ static void PPChangeMode( filter_t *p_filter, const char *psz_name,
int i_quality ) int i_quality )
{ {
filter_sys_t *p_sys = p_filter->p_sys; filter_sys_t *p_sys = p_filter->p_sys;
pp_mode *newmode = NULL, *oldmode;
vlc_mutex_lock( &p_sys->lock ); vlc_mutex_lock( &p_sys->lock );
if( i_quality > 0 ) if( i_quality > 0 )
{ {
pp_mode *pp_mode = pp_get_mode_by_name_and_quality( psz_name ? newmode = pp_get_mode_by_name_and_quality( psz_name ? psz_name :
psz_name : "default", i_quality );
"default", if( newmode == NULL )
i_quality );
if( pp_mode )
{ {
pp_free_mode( p_sys->pp_mode );
p_sys->pp_mode = pp_mode;
}
else
msg_Warn( p_filter, "Error while changing post processing mode. " msg_Warn( p_filter, "Error while changing post processing mode. "
"Keeping previous mode." ); "Keeping previous mode." );
return;
} }
else
{
pp_free_mode( p_sys->pp_mode );
p_sys->pp_mode = NULL;
} }
vlc_mutex_lock( &p_sys->lock );
oldmode = p_sys->pp_mode;
p_sys->pp_mode = newmode;
vlc_mutex_unlock( &p_sys->lock ); vlc_mutex_unlock( &p_sys->lock );
pp_free_mode( oldmode );
} }
static int PPQCallback( vlc_object_t *p_this, const char *psz_var, static int PPQCallback( vlc_object_t *p_this, const char *psz_var,
......
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