diff --git a/src/main.cpp b/src/main.cpp index 8f71582d..1a56d0a2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -323,8 +323,10 @@ int main(int argc, char *argv[]) { if (video::probe_encoders()) { #ifdef _WIN32 - // Create a temporary virtual display for encoder capability probing if no active display was found - if (!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) { std::string probe_uuid_str = PROBE_DISPLAY_UUID; auto probe_uuid = uuid_util::uuid_t::parse(probe_uuid_str); auto* probe_guid = (GUID*)(void*)&probe_uuid; @@ -344,17 +346,22 @@ int main(int argc, char *argv[]) { *probe_guid ); + std::this_thread::sleep_for(500ms); + // Probe again anyways - if (video::probe_encoders()) { - BOOST_LOG(error) << "Video failed to find working encoder even after attempted with a virtual display"sv; - } + probe_result = video::probe_encoders(); VDISPLAY::removeVirtualDisplay(*probe_guid); - } else { - if (proc::vDisplayDriverStatus == VDISPLAY::DRIVER_STATUS::OK) { + } 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: probe failed and virtual display driver isn't initialized"sv; + BOOST_LOG(error) << "Video failed to find working encoder even after attempted with a virtual display"sv; } } #else