[vlc-devel] [PATCH 2/2] decoder: remove vout polling from SPU decoders

Rémi Denis-Courmont remi at remlab.net
Tue Apr 2 18:00:38 CEST 2019


Le tiistaina 2. huhtikuuta 2019, 18.19.08 EEST Thomas Guillem a écrit :
> This fixes 2 issues:
>  - A decoder/UI blockage of 6 seconds if there is no vouts when stopping a
> SPU es.
>  - A possible delay of 200ms before getting the vout.
> ---
>  src/input/decoder.c | 21 ++++++---------------
>  1 file changed, 6 insertions(+), 15 deletions(-)
> 
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index 36b5ac8f89..a5c635eaef 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -151,7 +151,6 @@ struct decoder_owner
>  #define DECODER_BOGUS_VIDEO_DELAY               
> ((vlc_tick_t)(DEFAULT_PTS_DELAY * 30))
> 
>  /* */
> -#define DECODER_SPU_VOUT_WAIT_DURATION   VLC_TICK_FROM_MS(200)
>  #define BLOCK_FLAG_CORE_PRIVATE_RELOADED (1 <<
> BLOCK_FLAG_CORE_PRIVATE_SHIFT)
> 
>  static inline struct decoder_owner *dec_get_owner( decoder_t *p_dec )
> @@ -587,21 +586,8 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec,
>                                       const subpicture_updater_t *p_updater
> ) {
>      struct decoder_owner *p_owner = dec_get_owner( p_dec );
> -    vout_thread_t *p_vout = NULL;
>      subpicture_t *p_subpic;
> -    int i_attempts = 30;
> -
> -    while( i_attempts-- )
> -    {
> -        if( p_owner->error )
> -            break;
> -
> -        p_vout = input_resource_HoldVout( p_owner->p_resource );
> -        if( p_vout )
> -            break;
> -
> -        vlc_tick_sleep( DECODER_SPU_VOUT_WAIT_DURATION );
> -    }
> +    vout_thread_t *p_vout = input_resource_WaitVout( p_owner->p_resource,
> p_dec );

I am concerned that this might deadlock the whole ES output as the SPU ES can 
now wait forever for a video output to come.

AFAICT, to get rid of the polling and only that for the time being, 
input_resource_WaitVout should never sleep longer than 6 seconds. And then, 
the whole cancel dance would no longer be indispensible.

In any case, somebody who understands SPU should check this, probably Denis 
and/or François. I would think that the correct solution involves either 
creating an inactive video output and queueing the SPU in it (instead of 
waiting), or not selecting any SPU ES until after a video ES in the ES output.

-- 
レミ・デニ-クールモン
http://www.remlab.net/





More information about the vlc-devel mailing list