win-capture: Better laptop test for auto-selection

Only auto-select WGC for desktop capture if a battery exists and
multiple GPU adapters are present. May false-positive on desktops with
a smart UPS attached, but we don't know of a better test.
master
jpark37 2021-03-11 21:07:09 -08:00 committed by Jim
parent c03320cfc2
commit 7e263ab775
1 changed files with 16 additions and 2 deletions

View File

@ -159,8 +159,22 @@ choose_method(enum display_capture_method method, bool wgc_supported,
obs_leave_graphics();
}
if (method == METHOD_AUTO)
method = (*dxgi_index == -1) ? METHOD_WGC : METHOD_DXGI;
if (method == METHOD_AUTO) {
method = METHOD_DXGI;
if (*dxgi_index == -1) {
method = METHOD_WGC;
} else {
SYSTEM_POWER_STATUS status;
if (GetSystemPowerStatus(&status) &&
status.BatteryFlag < 128) {
obs_enter_graphics();
const uint32_t count = gs_get_adapter_count();
obs_leave_graphics();
if (count >= 2)
method = METHOD_WGC;
}
}
}
return method;
}