Browse Source

input: decoder: fix locking CC

vlc_input_decoder_HasCCChanFlag also needs to be protected, and the
owner->lock mutex will be removed in later patches, to be completely
replaced by the already existing fifo lock.

The new cc.lock allows better thread safety without risking a deadlock
between the super-decoder and the sub-decoder, by protecting the very
state being synced by both of them.
pull/138/head
Alexandre Janniaux 4 years ago
committed by Steve Lhomme
parent
commit
8f7b3838d3
  1. 7
      src/input/decoder.c

7
src/input/decoder.c

@ -2518,12 +2518,15 @@ int vlc_input_decoder_SetCcState( vlc_input_decoder_t *p_owner, vlc_fourcc_t cod
int vlc_input_decoder_GetCcState( vlc_input_decoder_t *p_owner, vlc_fourcc_t codec,
int i_channel, bool *pb_decode )
{
vlc_mutex_lock(&p_owner->cc.lock);
if( !vlc_input_decoder_HasCCChanFlag( p_owner, codec, i_channel ) )
{
vlc_mutex_unlock(&p_owner->cc.lock);
return VLC_EGENERIC;
}
vlc_mutex_lock( &p_owner->lock );
*pb_decode = p_owner->cc.pp_decoder[i_channel] != NULL;
vlc_mutex_unlock( &p_owner->lock );
vlc_mutex_unlock(&p_owner->cc.lock);
return VLC_SUCCESS;
}

Loading…
Cancel
Save