diff --git a/src/main.cpp b/src/main.cpp index 82802eb3..e8ffb9a3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -318,7 +318,7 @@ 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() && proc::vDisplayDriverStatus == VDISPLAY::DRIVER_STATUS::OK) { + if (!video::allow_encoder_probing()) { 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; @@ -340,15 +340,19 @@ int main(int argc, char *argv[]) { // Probe again anyways if (video::probe_encoders()) { - BOOST_LOG(error) << "Video failed to find working encoder"sv; + BOOST_LOG(error) << "Video failed to find working encoder even after attempted with a virtual display"sv; } VDISPLAY::removeVirtualDisplay(*probe_guid); } else { - BOOST_LOG(error) << "Video failed to find working encoder"sv; + if (proc::vDisplayDriverStatus == VDISPLAY::DRIVER_STATUS::OK) { + 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; + } } #else - BOOST_LOG(error) << "Video failed to find working encoder"sv; + BOOST_LOG(error) << "Video failed to find working encoder: probing failed."sv; #endif } diff --git a/src/video.cpp b/src/video.cpp index 9ba77949..51e4c0e8 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -32,6 +32,7 @@ extern "C" { #include "video.h" #ifdef _WIN32 + #include "platform/windows/virtual_display.h" extern "C" { #include } @@ -48,10 +49,19 @@ namespace video { bool allow_encoder_probing() { const auto devices {display_device::enumerate_devices()}; - // If there are no devices, then either the API is not working correctly or OS does not support the lib. - // Either way we should not block the probing in this case as we can't tell what's wrong. + // // If there are no devices, then either the API is not working correctly or OS does not support the lib. + // // Either way we should not block the probing in this case as we can't tell what's wrong. + // if (devices.empty()) { + // return true; + // } + if (devices.empty()) { - return true; + // We'll create a temporary virtual display for probing anyways. + if (proc::vDisplayDriverStatus == VDISPLAY::DRIVER_STATUS::OK) { + return false; + } else { + return true; + } } // Since Windows 11 24H2, it is possible that there will be no active devices present