PR #23953 opened by Kacper Michajłow (kasper93) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23953 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23953.patch
From 47faec0078808cd92d5cbbe3e7b112183b7080da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]> Date: Wed, 29 Jul 2026 22:00:39 +0200 Subject: [PATCH 1/2] avutil/hwcontext_opencl: don't fall through between mapping types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a mapping type is unavailable the case fell into the next hardware type's mapping function instead of returning ENOSYS. Signed-off-by: Kacper Michajłow <[email protected]> --- libavutil/hwcontext_opencl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c index 03f46238b2..e6aa8de60a 100644 --- a/libavutil/hwcontext_opencl.c +++ b/libavutil/hwcontext_opencl.c @@ -2937,32 +2937,38 @@ static int opencl_map_to(AVHWFramesContext *hwfc, AVFrame *dst, case AV_PIX_FMT_DRM_PRIME: if (priv->beignet_drm_mapping_usable) return opencl_map_from_drm_beignet(hwfc, dst, src, flags); + break; #endif #if HAVE_OPENCL_VAAPI_BEIGNET case AV_PIX_FMT_VAAPI: if (priv->beignet_drm_mapping_usable) return opencl_map_from_vaapi(hwfc, dst, src, flags); + break; #endif #if HAVE_OPENCL_VAAPI_INTEL_MEDIA case AV_PIX_FMT_QSV: case AV_PIX_FMT_VAAPI: if (priv->qsv_mapping_usable) return opencl_map_from_qsv(hwfc, dst, src, flags); + break; #endif #if HAVE_OPENCL_DXVA2 case AV_PIX_FMT_DXVA2_VLD: if (priv->dxva2_mapping_usable) return opencl_map_from_dxva2(hwfc, dst, src, flags); + break; #endif #if HAVE_OPENCL_D3D11 case AV_PIX_FMT_D3D11: if (priv->d3d11_mapping_usable) return opencl_map_from_d3d11(hwfc, dst, src, flags); + break; #endif #if HAVE_OPENCL_DRM_ARM case AV_PIX_FMT_DRM_PRIME: if (priv->drm_arm_mapping_usable) return opencl_map_from_drm_arm(hwfc, dst, src, flags); + break; #endif #if HAVE_OPENCL_VIDEOTOOLBOX case AV_PIX_FMT_VIDEOTOOLBOX: -- 2.52.0 From 3a81309855fad2eaf87a3f76e083393ab9536a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]> Date: Wed, 29 Jul 2026 22:00:46 +0200 Subject: [PATCH 2/2] avutil/hwcontext_qsv: fix fall-through in qsv_fixed_pool_map_to() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The break only applied to the matching case, so every non-matching surface fell into the next case and reinterpreted the same mfxHDLPair under another API. Signed-off-by: Kacper Michajłow <[email protected]> --- libavutil/hwcontext_qsv.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index b92c9cb0ad..186576d182 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -2154,10 +2154,9 @@ static int qsv_fixed_pool_map_to(AVHWFramesContext *dst_ctx, case AV_PIX_FMT_VAAPI: { mfxHDLPair *pair = (mfxHDLPair*)hwctx->surfaces[i].Data.MemId; - if (*(VASurfaceID*)pair->first == (VASurfaceID)(uintptr_t)src->data[3]) { + if (*(VASurfaceID*)pair->first == (VASurfaceID)(uintptr_t)src->data[3]) index = i; - break; - } + break; } #endif #if CONFIG_D3D11VA @@ -2166,20 +2165,18 @@ static int qsv_fixed_pool_map_to(AVHWFramesContext *dst_ctx, mfxHDLPair *pair = (mfxHDLPair*)hwctx->surfaces[i].Data.MemId; if (pair->first == src->data[0] && (pair->second == src->data[1] - || (pair->second == (mfxMemId)MFX_INFINITE && src->data[1] == (uint8_t *)0))) { + || (pair->second == (mfxMemId)MFX_INFINITE && src->data[1] == (uint8_t *)0))) index = i; - break; - } + break; } #endif #if CONFIG_DXVA2 case AV_PIX_FMT_DXVA2_VLD: { mfxHDLPair *pair = (mfxHDLPair*)hwctx->surfaces[i].Data.MemId; - if (pair->first == src->data[3]) { + if (pair->first == src->data[3]) index = i; - break; - } + break; } #endif } -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
