[libcamera-devel] [PATCH] pipeline: simple: set controlInfo_ to sensor_->controls()

Mattijs Korpershoek mkorpershoek at baylibre.com
Fri Mar 31 17:09:58 CEST 2023


Each pipeline has a ControlInfoMap to list the set of controls supported
by the camera.

ControlInfoMap() default constructor -used by simple pipeline-,
initializes its idmap_ member to nullptr.

Other methods such as ControlInfoMap::find() don't check for idmap_'s
validity so the following code (from find()) crashes:

        auto iter = idmap_->find(id);
        auto iter = nullptr->find(id);

Fix this by assigning the sensor's control info map.

Signed-off-by: Mattijs Korpershoek <mkorpershoek at baylibre.com>
---
Alternatively, we could null check everywhere in controls.cpp or
get rid of the default constructor for ControlInfoMap.
---
 src/libcamera/pipeline/simple/simple.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 2423ec10c878..4db3dc2812b0 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -537,6 +537,7 @@ int SimpleCameraData::init()
 	}
 
 	properties_ = sensor_->properties();
+	controlInfo_ = sensor_->controls();
 
 	return 0;
 }

---
base-commit: ac7511dc4c594f567ddff27ccc02c30bf6c00bfd
change-id: 20230331-simple-controls-fd92853c7cff

Best regards,
-- 
Mattijs Korpershoek <mkorpershoek at baylibre.com>



More information about the libcamera-devel mailing list