From c8f2acdea643676ab0d6bab3f36b2cb2891765d7 Mon Sep 17 00:00:00 2001 From: k4yt3x Date: Sat, 9 Nov 2024 00:00:00 +0000 Subject: [PATCH] feat(libplacebo): made hardware context creation failure non-critical Signed-off-by: k4yt3x --- src/libplacebo.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libplacebo.cpp b/src/libplacebo.cpp index 5d446d9..dc752c4 100644 --- a/src/libplacebo.cpp +++ b/src/libplacebo.cpp @@ -29,8 +29,8 @@ int init_libplacebo( &vk_hw_device_ctx, AV_HWDEVICE_TYPE_VULKAN, std::to_string(vk_device_index).c_str(), NULL, 0 ); if (ret < 0) { - spdlog::error("Failed to create Vulkan hardware device context."); - return ret; + spdlog::error("Failed to create Vulkan hardware device context for libplacebo."); + vk_hw_device_ctx = nullptr; } AVFilterGraph *graph = avfilter_graph_alloc(); @@ -118,8 +118,10 @@ int init_libplacebo( } // Set the hardware device context to Vulkan - libplacebo_ctx->hw_device_ctx = av_buffer_ref(vk_hw_device_ctx); - av_buffer_unref(&vk_hw_device_ctx); + if (vk_hw_device_ctx != nullptr) { + libplacebo_ctx->hw_device_ctx = av_buffer_ref(vk_hw_device_ctx); + av_buffer_unref(&vk_hw_device_ctx); + } // Link buffersrc to libplacebo ret = avfilter_link(last_filter, 0, libplacebo_ctx, 0);