Browse Source

input: decoder: add explicit input decoder flush

Ensure the input_decoder is flushed before deletion, so that it's not
stuck waiting on the decoder implementation or the output for the ES.

The end goal is to simplify vlc_input_decoder_Delete to ensure it is
either flushed or drained before being deleted, so that the wanted
behaviour is written in the code and frames are neither dropped when
they should have been played, nor drained during interruption, resulting
in increased response time.
pull/162/head
Alexandre Janniaux 3 years ago
committed by Steve Lhomme
parent
commit
cef875107b
  1. 5
      src/input/decoder.c

5
src/input/decoder.c

@ -2481,6 +2481,7 @@ int vlc_input_decoder_SetCcState( vlc_input_decoder_t *p_owner, vlc_fourcc_t cod
else if( !p_ccowner->dec.p_module )
{
DecoderUnsupportedCodec( p_dec, &fmt, true );
vlc_input_decoder_Flush(p_ccowner);
vlc_input_decoder_Delete(p_ccowner);
vlc_mutex_unlock(&p_owner->cc.lock);
return VLC_EGENERIC;
@ -2497,7 +2498,11 @@ int vlc_input_decoder_SetCcState( vlc_input_decoder_t *p_owner, vlc_fourcc_t cod
p_owner->cc.pp_decoder[i_channel] = NULL;
if( p_cc )
{
vlc_input_decoder_Flush(p_cc);
vlc_input_decoder_Delete(p_cc);
}
}
vlc_mutex_unlock(&p_owner->cc.lock);
return VLC_SUCCESS;

Loading…
Cancel
Save