mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
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.
This commit is contained in:
parent
07a4e593bb
commit
30ce210c2a
1 changed files with 3 additions and 3 deletions
|
|
@ -745,14 +745,14 @@ uint32_t control_to_prop_id(uint32_t control_id)
|
||||||
|
|
||||||
uint32_t prop_id_to_control(uint32_t prop_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) {
|
for (const auto& c : control_map) {
|
||||||
if (c.spa_id == prop_id)
|
if (c.spa_id == prop_id)
|
||||||
return c.id;
|
return c.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prop_id >= SPA_PROP_START_CUSTOM)
|
|
||||||
return prop_id - SPA_PROP_START_CUSTOM;
|
|
||||||
|
|
||||||
return SPA_ID_INVALID;
|
return SPA_ID_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue