diff mbox series

[FFmpeg-devel,2/2] vulkan_decode: use ff_vk_init

Message ID 20240901024143.438584-2-dev@lynne.ee
State New
Headers show
Series [FFmpeg-devel,1/2] vulkan: add a ff_vk_init function | expand

Checks

Context Check Description
yinshiyou/configure_loongarch64 warning Failed to apply patch
andriy/configure_x86 warning Failed to apply patch

Commit Message

Lynne Sept. 1, 2024, 2:41 a.m. UTC
This solves the issue of an av_log function being called
with a context with invalid class.

Most of the patch was written by Anton Khirnov.
---
 libavcodec/vulkan_decode.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

Comments

Kacper Michajlow Sept. 1, 2024, 4:30 a.m. UTC | #1
On Sun, 1 Sept 2024 at 04:42, Lynne via ffmpeg-devel
<ffmpeg-devel@ffmpeg.org> wrote:
>
> This solves the issue of an av_log function being called
> with a context with invalid class.
>
> Most of the patch was written by Anton Khirnov.

Does ffmpeg have conventions for such situations? I think most of the
time `Co-Authored-By: ` annotation is used.

> ---
>  libavcodec/vulkan_decode.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
> index 35966cd60d..f6b8866ff5 100644
> --- a/libavcodec/vulkan_decode.c
> +++ b/libavcodec/vulkan_decode.c
> @@ -1114,12 +1114,9 @@ int ff_vk_decode_init(AVCodecContext *avctx)
>      s = &ctx->s;
>      vk = &ctx->s.vkfn;
>
> -    s->frames_ref = av_buffer_ref(avctx->hw_frames_ctx);
> -    s->frames = (AVHWFramesContext *)s->frames_ref->data;
> -    s->hwfc = s->frames->hwctx;
> -
> -    s->device = (AVHWDeviceContext *)s->frames->device_ref->data;
> -    s->hwctx = s->device->hwctx;
> +    err = ff_vk_init(s, avctx, NULL, avctx->hw_frames_ctx);
> +    if (err < 0)
> +        return err;
>
>      profile = get_video_profile(ctx, avctx->codec_id);
>      if (!profile) {
> @@ -1127,10 +1124,6 @@ int ff_vk_decode_init(AVCodecContext *avctx)
>          return AVERROR(EINVAL);
>      }
>
> -    err = ff_vk_load_props(s);
> -    if (err < 0)
> -        goto fail;
> -
>      /* Create queue context */
>      vk_desc = get_codecdesc(avctx->codec_id);
>      err = ff_vk_video_qf_init(s, &ctx->qf,
> --
> 2.45.2.753.g447d99e1c3b
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Anton Khirnov Sept. 1, 2024, 1:11 p.m. UTC | #2
Quoting Kacper Michajlow (2024-09-01 06:30:24)
> On Sun, 1 Sept 2024 at 04:42, Lynne via ffmpeg-devel
> <ffmpeg-devel@ffmpeg.org> wrote:
> >
> > This solves the issue of an av_log function being called
> > with a context with invalid class.
> >
> > Most of the patch was written by Anton Khirnov.
> 
> Does ffmpeg have conventions for such situations? I think most of the
> time `Co-Authored-By: ` annotation is used.

Linux documentation recommends Co-developed-by
diff mbox series

Patch

diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
index 35966cd60d..f6b8866ff5 100644
--- a/libavcodec/vulkan_decode.c
+++ b/libavcodec/vulkan_decode.c
@@ -1114,12 +1114,9 @@  int ff_vk_decode_init(AVCodecContext *avctx)
     s = &ctx->s;
     vk = &ctx->s.vkfn;
 
-    s->frames_ref = av_buffer_ref(avctx->hw_frames_ctx);
-    s->frames = (AVHWFramesContext *)s->frames_ref->data;
-    s->hwfc = s->frames->hwctx;
-
-    s->device = (AVHWDeviceContext *)s->frames->device_ref->data;
-    s->hwctx = s->device->hwctx;
+    err = ff_vk_init(s, avctx, NULL, avctx->hw_frames_ctx);
+    if (err < 0)
+        return err;
 
     profile = get_video_profile(ctx, avctx->codec_id);
     if (!profile) {
@@ -1127,10 +1124,6 @@  int ff_vk_decode_init(AVCodecContext *avctx)
         return AVERROR(EINVAL);
     }
 
-    err = ff_vk_load_props(s);
-    if (err < 0)
-        goto fail;
-
     /* Create queue context */
     vk_desc = get_codecdesc(avctx->codec_id);
     err = ff_vk_video_qf_init(s, &ctx->qf,