PR #25830 opened by romainhedouin
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25830
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25830.patch

ff_vulkan_encode_init() returned a stale 0 when the device has no encode queue 
for the codec, so h264_vulkan and hevc_vulkan crashed in avcodec_open2(). 
Return AVERROR(ENOSYS) instead.

Fixes #22831.
The fairy suggested ENOTSUP to get back to the old behavior, I agree with 
@neatnoise that ENOSYS is more fitting but it really doesn't fundamentally 
matter.

Fixed and tested with the help of an LLM.

Signed-off-by: romainhedouin <[email protected]>

<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).

Attached filenames must match the sample's filename:

```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->



>From 58c0d7256732a8989bab8a63e6bb568df7e33603 Mon Sep 17 00:00:00 2001
From: romainhedouin <[email protected]>
Date: Sat, 7 Nov 2026 03:18:10 +0100
Subject: [PATCH] avcodec/vulkan_encode: return an error if there is no encode
 queue

err is still 0 here, so ff_vulkan_encode_init() reported success without
a queue and h264_vulkan/hevc_vulkan crashed in avcodec_open2().

Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/22831
Fix written with the help of an LLM; reproduced and tested before submission.

Signed-off-by: romainhedouin <[email protected]>
---
 libavcodec/vulkan_encode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vulkan_encode.c b/libavcodec/vulkan_encode.c
index 9d3c9b04c57..f57a5edef3e 100644
--- a/libavcodec/vulkan_encode.c
+++ b/libavcodec/vulkan_encode.c
@@ -884,7 +884,7 @@ av_cold int ff_vulkan_encode_init(AVCodecContext *avctx, 
FFVulkanEncodeContext *
     if (!ctx->qf_enc) {
         av_log(avctx, AV_LOG_ERROR, "Encoding of %s is not supported by this 
device\n",
                avcodec_get_name(avctx->codec_id));
-        return err;
+        return AVERROR(ENOSYS);
     }
 
     /* Load all properties */
-- 
2.54.0

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

Reply via email to