History

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.

Timo Rothenpieler committed 3 years ago

Commit ee650391 parent fc016fd1 file · +10 −1Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_libplacebo.c+10−1
@@ -252,6 +252,7 @@ static int init_vulkan(AVFilterContext *avctx) · 251 unmodified lines
252{252{
253 int err = 0;253 int err = 0;
254 LibplaceboContext *s = avctx->priv;254 LibplaceboContext *s = avctx->priv;
255 const AVHWDeviceContext *avhwctx;
255 const AVVulkanDeviceContext *hwctx;256 const AVVulkanDeviceContext *hwctx;
256 uint8_t *buf = NULL;257 uint8_t *buf = NULL;
257 size_t buf_len;258 size_t buf_len;
@@ -261,7 +262,15 @@ static int init_vulkan(AVFilterContext *avctx) · 3 unmodified lines
261 return AVERROR(EINVAL);262 return AVERROR(EINVAL);
262 }263 }
263 264
264 hwctx = ((AVHWDeviceContext*) avctx->hw_device_ctx->data)->hwctx;265 avhwctx = avctx->hw_device_ctx->data;
266
267 if (avhwctx->type != AV_HWDEVICE_TYPE_VULKAN) {
268 av_log(s, AV_LOG_ERROR, "Expected vulkan hwdevice for vf_libplacebo, got %s.\n",
269 av_hwdevice_get_type_name(avhwctx->type));
270 return AVERROR(EINVAL);
271 }
272
273 hwctx = avhwctx->hwctx;
265 274
266 /* Import libavfilter vulkan context into libplacebo */275 /* Import libavfilter vulkan context into libplacebo */
267 s->vulkan = pl_vulkan_import(s->log, pl_vulkan_import_params(276 s->vulkan = pl_vulkan_import(s->log, pl_vulkan_import_params(

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t