* [FFmpeg-devel] [PATCH] avcodec/avfilter_amf: correct handling of AMF errors (PR #21155)
@ 2025-12-10 15:17 ArazIusubov via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: ArazIusubov via ffmpeg-devel @ 2025-12-10 15:17 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: ArazIusubov
PR #21155 opened by ArazIusubov
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21155
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21155.patch
Fixes several [AMF error handling issues #21123](https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/21123)
>From ba95421cbfefebc00438c7b79f3dbd46714e1e2b Mon Sep 17 00:00:00 2001
From: Araz Iusubov <Primeadvice@gmail.com>
Date: Wed, 10 Dec 2025 15:38:55 +0100
Subject: [PATCH] avcodec/avfilter_amf: correct handling of AMF errors
---
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,
};
--
2.49.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-12-10 15:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-10 15:17 [FFmpeg-devel] [PATCH] avcodec/avfilter_amf: correct handling of AMF errors (PR #21155) ArazIusubov via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git