Fix encoder probing when no display is active

This commit is contained in:
Yukino Song
2025-05-31 15:04:06 +08:00
parent 34766201d2
commit 1ca19853c2
2 changed files with 21 additions and 7 deletions

View File

@@ -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
}