spa: libcamera: source: prop_id_to_control(): do range check first

If it is a custom spa property, it will not be found in the lookup
table, so we can return immediately.

(cherry picked from commit 30ce210c2a)
This commit is contained in:
Barnabás Pőcze 2025-07-24 09:17:22 +02:00 committed by Robert Mader
parent b775acca60
commit a080a4a6f2

View file

@ -744,14 +744,14 @@ uint32_t control_to_prop_id(uint32_t control_id)
uint32_t prop_id_to_control(uint32_t prop_id)
{
if (prop_id >= SPA_PROP_START_CUSTOM)
return prop_id - SPA_PROP_START_CUSTOM;
for (const auto& c : control_map) {
if (c.spa_id == prop_id)
return c.id;
}
if (prop_id >= SPA_PROP_START_CUSTOM)
return prop_id - SPA_PROP_START_CUSTOM;
return SPA_ID_INVALID;
}