fix(video): allow encoder probing when there are no devices at all (#3594)

This commit is contained in:
Lukas Senionis 2025-01-27 19:19:47 +02:00 committed by GitHub
commit 23e131439f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 41 additions and 14 deletions

View file

@ -810,19 +810,15 @@ namespace display_device {
});
}
bool is_any_device_active() {
EnumeratedDeviceList enumerate_devices() {
std::lock_guard lock {DD_DATA.mutex};
if (!DD_DATA.sm_instance) {
// Platform is not supported, assume success.
return true;
// Platform is not supported.
return {};
}
return DD_DATA.sm_instance->execute([](auto &settings_iface) {
const auto devices {settings_iface.enumAvailableDevices()};
// If at least one device has additional info, it is active.
return std::any_of(std::begin(devices), std::end(devices), [](const auto &device) {
return static_cast<bool>(device.m_info);
});
return settings_iface.enumAvailableDevices();
});
}