[vlc-devel] [PATCH] opengl: interop: avoid generic interop with opaque

Romain Vimont rom1v at videolabs.io
Tue Nov 17 11:25:15 CET 2020


LGTM

On Tue, Nov 17, 2020 at 11:19:35AM +0100, Alexandre Janniaux wrote:
> The generic interop is designed for CPU buffers which are not available
> anyway with GPU buffers (zero planes available). Avoid loading the
> generic interop in that case.
> 
> Refs #25256
> ---
>  modules/video_output/opengl/interop.c | 24 +++++++++++-------------
>  1 file changed, 11 insertions(+), 13 deletions(-)
> 
> diff --git a/modules/video_output/opengl/interop.c b/modules/video_output/opengl/interop.c
> index 96d548519e..9abb2f802f 100644
> --- a/modules/video_output/opengl/interop.c
> +++ b/modules/video_output/opengl/interop.c
> @@ -55,30 +55,28 @@ vlc_gl_interop_New(struct vlc_gl_t *gl, const struct vlc_gl_api *api,
>          vlc_object_delete(interop);
>          return NULL;
>      }
> +
>      if (desc->plane_count == 0)
>      {
>          /* Opaque chroma: load a module to handle it */
>          interop->vctx = context;
>          interop->module = module_need_var(interop, "glinterop", "glinterop");
> +        if (interop->module == NULL)
> +            goto error;
>      }
> -
> -    int ret;
> -    if (interop->module != NULL)
> -        ret = VLC_SUCCESS;
>      else
>      {
> -        /* Software chroma or gl hw converter failed: use a generic
> -         * converter */
> -        ret = opengl_interop_generic_init(interop, true);
> -    }
> -
> -    if (ret != VLC_SUCCESS)
> -    {
> -        vlc_object_delete(interop);
> -        return NULL;
> +        /* No opengl interop module found: use a generic interop. */
> +        int ret = opengl_interop_generic_init(interop, true);
> +        if (ret != VLC_SUCCESS)
> +            goto error;
>      }
>  
>      return interop;
> +
> +error:
> +    vlc_object_delete(interop);
> +    return NULL;
>  }
>  
>  struct vlc_gl_interop *
> -- 
> 2.29.2
> 
> _______________________________________________
> 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