From a080a4a6f2eac4ccec0b27f56cc8ccd1c78e2fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Thu, 24 Jul 2025 09:17:22 +0200 Subject: [PATCH] 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 30ce210c2a617e2a9e6466edadb0e2c4f642666a) --- spa/plugins/libcamera/libcamera-source.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spa/plugins/libcamera/libcamera-source.cpp b/spa/plugins/libcamera/libcamera-source.cpp index dd870c5ec..bac481360 100644 --- a/spa/plugins/libcamera/libcamera-source.cpp +++ b/spa/plugins/libcamera/libcamera-source.cpp @@ -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; }