[FFmpeg-cvslog] avfilter/vf_libplacebo: ensure filter hwdevice is a vulkan one
Timo Rothenpieler
git at videolan.org
Sun Dec 4 16:51:44 EET 2022
ffmpeg | branch: master | Timo Rothenpieler <timo at rothenpieler.org> | Sun Dec 4 15:22:13 2022 +0100| [ee650398ec29861a1fe5c8d1a905cc340e82378d] | committer: Timo Rothenpieler
avfilter/vf_libplacebo: ensure filter hwdevice is a vulkan one
Before this, the filter blindly casts to AVVulkanDeviceContext and
passes invalid values to libplacebo if it's not.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ee650398ec29861a1fe5c8d1a905cc340e82378d
---
libavfilter/vf_libplacebo.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index 3678b60b7d..d3c62d12a4 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -252,6 +252,7 @@ static int init_vulkan(AVFilterContext *avctx)
{
int err = 0;
LibplaceboContext *s = avctx->priv;
+ const AVHWDeviceContext *avhwctx;
const AVVulkanDeviceContext *hwctx;
uint8_t *buf = NULL;
size_t buf_len;
@@ -261,7 +262,15 @@ static int init_vulkan(AVFilterContext *avctx)
return AVERROR(EINVAL);
}
- hwctx = ((AVHWDeviceContext*) avctx->hw_device_ctx->data)->hwctx;
+ avhwctx = avctx->hw_device_ctx->data;
+
+ if (avhwctx->type != AV_HWDEVICE_TYPE_VULKAN) {
+ av_log(s, AV_LOG_ERROR, "Expected vulkan hwdevice for vf_libplacebo, got %s.\n",
+ av_hwdevice_get_type_name(avhwctx->type));
+ return AVERROR(EINVAL);
+ }
+
+ hwctx = avhwctx->hwctx;
/* Import libavfilter vulkan context into libplacebo */
s->vulkan = pl_vulkan_import(s->log, pl_vulkan_import_params(
More information about the ffmpeg-cvslog
mailing list