[vlc-devel] [RFC PATCH 1/9] es_out: assert that demux ids are coherent
Rémi Denis-Courmont
remi at remlab.net
Wed Feb 12 17:44:46 CET 2020
Le keskiviikkona 12. helmikuuta 2020, 16.43.19 EET Thomas Guillem a écrit :
> ---
> src/input/es_out.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/src/input/es_out.c b/src/input/es_out.c
> index 9407c2377bf..fb1a196a2fc 100644
> --- a/src/input/es_out.c
> +++ b/src/input/es_out.c
> @@ -176,6 +176,9 @@ typedef struct
>
> /* all es */
> int i_id;
> +#ifndef NDEBUG
> + int i_auto_id;
> +#endif
> struct vlc_list es;
> struct vlc_list es_slaves; /* Dynamically created es on regular es
> selection */
>
> @@ -1893,6 +1896,19 @@ static es_out_id_t *EsOutAddSlaveLocked( es_out_t
> *out, const es_format_t *fmt, free( es );
> return NULL;
> }
> +
> +#ifndef NDEBUG
> + /* Make sure that demux modules send coherent fmt.i_ids. Demux modules
> + * should only send one type of ids: automatic (-1) or valid (>=0).
> + * Otherwise, this can lead to i_id collision */
> + if( p_sys->i_auto_id == 0 )
> + p_sys->i_auto_id = es->fmt.i_id < 0 ? 1 : 2;
> + if( es->fmt.i_id < 0 )
> + assert( p_sys->i_auto_id == 1 );
> + else
> + assert( p_sys->i_auto_id == 2 );
> +#endif
> +
This is hard to follow. This looks like it should be an enum.
> if( es->fmt.i_id < 0 )
> es->fmt.i_id = p_sys->i_id;
> if( !es->fmt.i_original_fourcc )
--
Реми Дёни-Курмон
http://www.remlab.net/
More information about the vlc-devel
mailing list