From 5606840c8983b714a0e442c42d887a49807715e1 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 1 Mar 2024 20:52:17 -0600 Subject: [PATCH] Stop enumeration after finding a working capture backend --- src/platform/linux/misc.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/platform/linux/misc.cpp b/src/platform/linux/misc.cpp index ecc5887e..0075d450 100644 --- a/src/platform/linux/misc.cpp +++ b/src/platform/linux/misc.cpp @@ -836,27 +836,29 @@ namespace platf { #endif #ifdef SUNSHINE_BUILD_CUDA - if (config::video.capture.empty() || config::video.capture == "nvfbc") { + if ((config::video.capture.empty() && sources.none()) || config::video.capture == "nvfbc") { if (verify_nvfbc()) { sources[source::NVFBC] = true; } } #endif #ifdef SUNSHINE_BUILD_WAYLAND - if (config::video.capture.empty() || config::video.capture == "wlr") { + if ((config::video.capture.empty() && sources.none()) || config::video.capture == "wlr") { if (verify_wl()) { sources[source::WAYLAND] = true; } } #endif #ifdef SUNSHINE_BUILD_DRM - if (config::video.capture.empty() || config::video.capture == "kms") { + if ((config::video.capture.empty() && sources.none()) || config::video.capture == "kms") { if (verify_kms()) { sources[source::KMS] = true; } } #endif #ifdef SUNSHINE_BUILD_X11 + // We enumerate this capture backend regardless of other suitable sources, + // since it may be needed as a NvFBC fallback for software encoding on X11. if (config::video.capture.empty() || config::video.capture == "x11") { if (verify_x11()) { sources[source::X11] = true;