From ac296864ace96f51ad75f78b90644bdbca76c332 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 24 Oct 2026 22:41:06 -0500 Subject: [PATCH] Fix some error handling in the libplacebo renderer --- app/streaming/video/ffmpeg-renderers/plvk.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/streaming/video/ffmpeg-renderers/plvk.cpp b/app/streaming/video/ffmpeg-renderers/plvk.cpp index 3a7b2a10..07ccce8f 100644 --- a/app/streaming/video/ffmpeg-renderers/plvk.cpp +++ b/app/streaming/video/ffmpeg-renderers/plvk.cpp @@ -769,6 +769,7 @@ bool PlVkRenderer::populateQueues(int videoFormat) vkDeviceContext->nb_comp_queues = m_Vulkan->queue_compute.count; // Select a video decode queue that is capable of decoding our chosen format + vkDeviceContext->queue_family_decode_index = -1; for (uint32_t i = 0; i < queueFamilyCount; i++) { if (queueFamilies[i].queueFamilyProperties.queueFlags & VK_QUEUE_VIDEO_DECODE_BIT_KHR) { if (videoFormat & VIDEO_FORMAT_MASK_H264) { @@ -897,6 +898,16 @@ void PlVkRenderer::waitToRender() return; } + // If a swapchain (re)creation failed, m_Swapchain is NULL. We can't render + // or resize it, and a device reset has already been requested, so skip this + // frame and let the main thread recreate the renderer. + if (m_Swapchain == nullptr) { + SDL_Event event; + event.type = SDL_RENDER_DEVICE_RESET; + SDL_PushEvent(&event); + return; + } + #ifndef Q_OS_WIN32 // With libplacebo's Vulkan backend, all swap_buffers does is wait for queued // presents to finish. This happens to be exactly what we want to do here, since