From 9753a996dacd0fc161b36c9541fb652ddef64a39 Mon Sep 17 00:00:00 2001 From: Yukino Song Date: Wed, 16 Jul 2025 03:21:18 +0800 Subject: [PATCH] Straighten logic when probing for encoders --- src/main.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 1a56d0a2..51a59989 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -323,7 +323,7 @@ int main(int argc, char *argv[]) { if (video::probe_encoders()) { #ifdef _WIN32 - bool allow_probing = !video::allow_encoder_probing(); + bool allow_probing = video::allow_encoder_probing(); bool probe_result = false; // Create a temporary virtual display for encoder capability probing if (proc::vDisplayDriverStatus == VDISPLAY::DRIVER_STATUS::OK) { @@ -349,21 +349,18 @@ int main(int argc, char *argv[]) { std::this_thread::sleep_for(500ms); // Probe again anyways - probe_result = video::probe_encoders(); + if (video::probe_encoders()) { + if (allow_probing) { + BOOST_LOG(error) << "Video failed to find working encoder: allow probing but failed"sv; + } else { + BOOST_LOG(error) << "Video failed to find working encoder even after attempted with a virtual display"sv; + } + } VDISPLAY::removeVirtualDisplay(*probe_guid); } else if (!allow_probing) { BOOST_LOG(error) << "Video failed to find working encoder: probe failed and virtual display driver isn't initialized"sv; } - - // When probing still fails somehow - if (allow_probing && probe_result) { - if (allow_probing) { - BOOST_LOG(error) << "Video failed to find working encoder: allow probing but failed"sv; - } else { - BOOST_LOG(error) << "Video failed to find working encoder even after attempted with a virtual display"sv; - } - } #else BOOST_LOG(error) << "Video failed to find working encoder: probing failed."sv; #endif