This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 4479d28103 avcodec/avfilter_amf: correct handling of AMF errors
4479d28103 is described below

commit 4479d28103acfc96266ec03b1061e2311edb541c
Author:     Araz Iusubov <[email protected]>
AuthorDate: Wed Dec 10 15:38:55 2025 +0100
Commit:     ArazIusubov <[email protected]>
CommitDate: Mon Dec 22 14:58:59 2025 +0000

    avcodec/avfilter_amf: correct handling of AMF errors
    
    Fix several AMF-related issues.
    
    Check the return value of amf_init_frames_context() correctly in amfdec,
    as it returns int rather than AMF_RESULT.
    
    Handle possible NULL surfaces returned from QueryInterface() in
    vf_amf_common to avoid passing invalid data to amf_amfsurface_to_avframe().
    
    Remove FILTER_SINGLE_PIXFMT from vf_sr_amf since it must not be used
    together with a query formats function.
---
 libavcodec/amfdec.c         | 5 +++--
 libavfilter/vf_amf_common.c | 5 ++++-
 libavfilter/vf_sr_amf.c     | 1 -
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavcodec/amfdec.c b/libavcodec/amfdec.c
index e1a5b71ee6..6a0e0e441c 100644
--- a/libavcodec/amfdec.c
+++ b/libavcodec/amfdec.c
@@ -640,9 +640,10 @@ static int amf_decode_frame(AVCodecContext *avctx, struct 
AVFrame *frame)
                 return AVERROR(EINVAL);
             }
             res = ctx->decoder->pVtbl->GetProperty(ctx->decoder, 
AMF_VIDEO_DECODER_OUTPUT_FORMAT, &format_var);
-            if (res == AMF_OK) {
-                res = amf_init_frames_context(avctx, 
av_amf_to_av_format(format_var.int64Value), avctx->coded_width, 
avctx->coded_height);
+            if (res != AMF_OK) {
+                return AVERROR(EINVAL);
             }
+            int ret = amf_init_frames_context(avctx, 
av_amf_to_av_format(format_var.int64Value), avctx->coded_width, 
avctx->coded_height);
 
             if (res < 0)
                 return AVERROR(EINVAL);
diff --git a/libavfilter/vf_amf_common.c b/libavfilter/vf_amf_common.c
index ae095c6a6c..c8620bc513 100644
--- a/libavfilter/vf_amf_common.c
+++ b/libavfilter/vf_amf_common.c
@@ -101,8 +101,11 @@ int amf_filter_filter_frame(AVFilterLink *inlink, AVFrame 
*in)
 
     if (data_out) {
         AMFGuid guid = IID_AMFSurface();
-        data_out->pVtbl->QueryInterface(data_out, &guid, 
(void**)&surface_out); // query for buffer interface
+        res = data_out->pVtbl->QueryInterface(data_out, &guid, 
(void**)&surface_out); // query for buffer interface
         data_out->pVtbl->Release(data_out);
+        AMF_RETURN_IF_FALSE(avctx, res == AMF_OK, AVERROR_UNKNOWN, 
"QueryInterface(IID_AMFSurface) failed with error %d\n", res);
+    } else {
+        return AVERROR(EAGAIN);
     }
 
     out = amf_amfsurface_to_avframe(avctx, surface_out);
diff --git a/libavfilter/vf_sr_amf.c b/libavfilter/vf_sr_amf.c
index 543d2cb979..2179e81d2c 100644
--- a/libavfilter/vf_sr_amf.c
+++ b/libavfilter/vf_sr_amf.c
@@ -180,6 +180,5 @@ FFFilter ff_vf_sr_amf = {
     FILTER_INPUTS(amf_filter_inputs),
     FILTER_OUTPUTS(amf_filter_outputs),
     FILTER_QUERY_FUNC(&amf_filter_query_formats),
-    FILTER_SINGLE_PIXFMT(AV_PIX_FMT_AMF_SURFACE),
     .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to