[vlc-devel] [RFC PATCH] input/decoder: copy-initialize decoder_t.fmt_out in LoadDecoder

Thomas Guillem thomas at gllm.fr
Tue Jul 12 09:20:40 CEST 2016



On Tue, Jul 12, 2016, at 00:56, Filip Roséen wrote:
> Given that there are certain entities within the "es_format_t" that a
> decoder normally cannot know about (such as
> "es_format_t.psz_description"),
> this patch copy-initializes "p_dec->fmt_out" with data coming from the
> demuxer* prior to creating the packetizer/decoder.
> 
> This patch fixes a bug where metadata associated with a track would go
> missing when it is being played (because EsOutUpdateInfo is indirectly
> called with an es_format_t lacking such data).
> 
> * or previous packetizer
> 
> --
> 
> This patch is marked as RFC because I do not know if a decoder can make
> certain assumptions regarding the state of p_dec->fmt_out (such as
> assuming that all data-members that requires a free are NULL).
> 
>     - Can someone please enlighten me on this matter?

Decoder modules assume than fmt_out is empty.
It is the job of the decoder module to fill fmt_out.video/audio

>     - Is there a better way to solve this problem?

I would have modified DecoderUpdateFormatLocked to copy
fmt_in.psz_description to p_owner->fmt. But I'm not sure this is the
right solution too.

> 
> Thank you.
> ---
>  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 06e569d..2b900bd 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -151,7 +151,7 @@ static int LoadDecoder( decoder_t *p_dec, bool
> b_packetizer,
>      p_dec->pf_flush = NULL;
>  
>      es_format_Copy( &p_dec->fmt_in, p_fmt );
> -    es_format_Init( &p_dec->fmt_out, UNKNOWN_ES, 0 );
> +    es_format_Copy( &p_dec->fmt_out, p_fmt );
>  
>      /* Find a suitable decoder/packetizer module */
>      if( !b_packetizer )
> @@ -162,6 +162,7 @@ static int LoadDecoder( decoder_t *p_dec, bool
> b_packetizer,
>      if( !p_dec->p_module )
>      {
>          es_format_Clean( &p_dec->fmt_in );
> +        es_format_Clean( &p_dec->fmt_out );
>          return -1;
>      }
>      else
> -- 
> 2.9.0
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list