Commit 928c9fa7 authored by Rafaël Carré's avatar Rafaël Carré

ts mux ActiveKeyCallback: reduce critical section

parent 46706e0a
......@@ -899,17 +899,26 @@ static int ActiveKeyCallback( vlc_object_t *p_this, char const *psz_cmd,
VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data);
sout_mux_t *p_mux = (sout_mux_t*)p_this;
sout_mux_sys_t *p_sys = p_mux->p_sys;
int i_res = VLC_EBADVAR;
int i_res, use_odd = -1;
vlc_mutex_lock( &p_sys->csa_lock );
if( !strcmp(newval.psz_string, "odd" ) || !strcmp(newval.psz_string, "first" ) || !strcmp(newval.psz_string, "1" ) )
if( !strcmp(newval.psz_string, "odd" ) ||
!strcmp(newval.psz_string, "first" ) ||
!strcmp(newval.psz_string, "1" ) )
{
i_res = csa_UseKey( (vlc_object_t*)p_mux, p_sys->csa, 1 );
use_odd = 1;
}
else if( !strcmp(newval.psz_string, "even" ) || !strcmp(newval.psz_string, "second" ) || !strcmp(newval.psz_string, "2" ) )
else if( !strcmp(newval.psz_string, "even" ) ||
!strcmp(newval.psz_string, "second" ) ||
!strcmp(newval.psz_string, "2" ) )
{
i_res = csa_UseKey( (vlc_object_t*)p_mux, p_sys->csa, 0 );
use_odd = 0;
}
if (use_odd < 0)
return VLC_EBADVAR;
vlc_mutex_lock( &p_sys->csa_lock );
i_res = csa_UseKey( p_this, p_sys->csa, use_odd );
vlc_mutex_unlock( &p_sys->csa_lock );
return i_res;
......
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