[vlc-devel] [PATCH 2/3] filter_chain: remove harmful handling for video buffer

Thomas Guillem thomas at gllm.fr
Thu Jun 18 13:31:18 CEST 2020


Are you sure this doesn't break anything? Did you test taking snapshot with linux/windows hw video decoding or inserting sw filter with hw decoding?

Otherwise, OK for me but other opinions are welcome.

On Thu, Jun 18, 2020, at 10:50, Alexandre Janniaux wrote:
> The previous new_buffer owner callback was creating picture with an
> incorrect format in filter_chains, leading to assertion in case of
> format change in a CVPX -> CVPX -> Software chroma chain, and in general
> crash in the filter pipeline because of filter chroma not matching with
> picture chroma.
> 
> This patch completely remove the special handling for that but keep the
> callback function to add details about what is needed to implement this
> function correctly. It would create new pictures unconditionnally
> instead of forwarding the creation request to the filter owner.
> ---
>  src/misc/filter_chain.c | 29 ++++-------------------------
>  1 file changed, 4 insertions(+), 25 deletions(-)
> 
> diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
> index 7b1a0ff63b..dc3ae9abbb 100644
> --- a/src/misc/filter_chain.c
> +++ b/src/misc/filter_chain.c
> @@ -98,31 +98,10 @@ filter_chain_t *filter_chain_NewSPU( vlc_object_t 
> *obj, const char *cap )
>  /** Chained filter picture allocator function */
>  static picture_t *filter_chain_VideoBufferNew( filter_t *filter )
>  {
> -    picture_t *pic;
> -    chained_filter_t *chained = container_of(filter, chained_filter_t, 
> filter);
> -    if( chained->next != NULL )
> -    {
> -        // HACK as intermediate filters may not have the same video 
> format as
> -        // the last one handled by the owner
> -        filter_owner_t saved_owner = filter->owner;
> -        filter->owner = (filter_owner_t) {};
> -        pic = filter_NewPicture( filter );
> -        filter->owner = saved_owner;
> -        if( pic == NULL )
> -            msg_Err( filter, "Failed to allocate picture" );
> -    }
> -    else
> -    {
> -        filter_chain_t *chain = filter->owner.sys;
> -
> -        // the owner of the chain requires pictures from the last 
> filter to be grabbed from its callback
> -        /* XXX ugly */
> -        filter_owner_t saved_owner = filter->owner;
> -        filter->owner = chain->parent_video_owner;
> -        pic = filter_NewPicture( filter );
> -        filter->owner = saved_owner;
> -    }
> -    return pic;
> +    /* TODO: We don't handle special case for chained filter yet.
> +     *       It must be done while ensuring each filter gets the
> +     *       correct format for new picture. */
> +    return picture_NewFromFormat(&filter->fmt_out.video);
>  }
>  
>  static vlc_decoder_device * 
> filter_chain_HoldDecoderDevice(vlc_object_t *o, void *sys)
> -- 
> 2.27.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