Skip to content

Commit c8f2acd

Browse files
committed
feat(libplacebo): made hardware context creation failure non-critical
Signed-off-by: k4yt3x <i@k4yt3x.com>
1 parent aa8ed60 commit c8f2acd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/libplacebo.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ int init_libplacebo(
2929
&vk_hw_device_ctx, AV_HWDEVICE_TYPE_VULKAN, std::to_string(vk_device_index).c_str(), NULL, 0
3030
);
3131
if (ret < 0) {
32-
spdlog::error("Failed to create Vulkan hardware device context.");
33-
return ret;
32+
spdlog::error("Failed to create Vulkan hardware device context for libplacebo.");
33+
vk_hw_device_ctx = nullptr;
3434
}
3535

3636
AVFilterGraph *graph = avfilter_graph_alloc();
@@ -118,8 +118,10 @@ int init_libplacebo(
118118
}
119119

120120
// Set the hardware device context to Vulkan
121-
libplacebo_ctx->hw_device_ctx = av_buffer_ref(vk_hw_device_ctx);
122-
av_buffer_unref(&vk_hw_device_ctx);
121+
if (vk_hw_device_ctx != nullptr) {
122+
libplacebo_ctx->hw_device_ctx = av_buffer_ref(vk_hw_device_ctx);
123+
av_buffer_unref(&vk_hw_device_ctx);
124+
}
123125

124126
// Link buffersrc to libplacebo
125127
ret = avfilter_link(last_filter, 0, libplacebo_ctx, 0);

0 commit comments

Comments
 (0)