[vlc-devel] [PATCH] decoder: fix race in spu_new_buffer
Thomas Guillem
thomas at gllm.fr
Thu Mar 19 22:36:26 CET 2015
Any opinions ?
This race is quite recent: I guess that some demux changed and feed the
spu decoder before the video one. But I also had it since quite a long
time with my WIP asynchronous video decoder, maybe because
decoder_NewPicture is called too late.
On Wed, Mar 18, 2015, at 11:16, Thomas Guillem wrote:
> There is a race when starting video with subtitles at a given position
> (via
> --start-time).
>
> If all decoders are flushed early, the video decoder may not have created
> the
> Vout via the decoder_NewPicture call. In that case, spu_new_buffer will
> be
> blocking for 6 seconds. Indeed, spu_new_buffer can block for maximum 6
> seconds
> when it's waiting for a Vout.
>
> To solve this race, abort spu_new_buffer if decoder is flushing.
>
> How to reproduce the race condition:
> ./vlc --start-time 3600 <video_with_subtitles>
> ---
> src/input/decoder.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index ad54288..cf7561f 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -2175,7 +2175,8 @@ static subpicture_t *spu_new_buffer( decoder_t
> *p_dec,
>
> while( i_attempts-- )
> {
> - if( DecoderIsExitRequested( p_dec ) || p_dec->b_error )
> + if( DecoderIsExitRequested( p_dec ) || DecoderIsFlushing( p_dec
> )
> + || p_dec->b_error )
> break;
>
> p_vout = input_resource_HoldVout( p_owner->p_resource );
> --
> 2.1.3
>
More information about the vlc-devel
mailing list