Skip to content

Commit 4217c9f

Browse files
committed
libcamera: camera: Zero streams before validate()
The current implementation of the Camera::configure() method zeroes the stream pointers assigned to the StreamConfiguration items before calling the pipeline handler configure() operation, just after the CameraConfiguration has been validated. This discards the stream assignment performed at pipeline hander validation time, requiring platforms that need to perform that early assignment to maintain the association in place with custom data structures. To allow pipeline handlers to use StreamConfiguration::setStream() at validate() time, zero the stream assignment before calling validate(). Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
1 parent 117e65c commit 4217c9f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/libcamera/camera.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,9 @@ int Camera::configure(CameraConfiguration *config)
753753
if (ret < 0)
754754
return ret;
755755

756+
for (auto it : *config)
757+
it.setStream(nullptr);
758+
756759
if (config->validate() != CameraConfiguration::Valid) {
757760
LOG(Camera, Error)
758761
<< "Can't configure camera with invalid configuration";
@@ -763,7 +766,6 @@ int Camera::configure(CameraConfiguration *config)
763766

764767
for (unsigned int index = 0; index < config->size(); ++index) {
765768
StreamConfiguration &cfg = config->at(index);
766-
cfg.setStream(nullptr);
767769
msg << " (" << index << ") " << cfg.toString();
768770
}
769771

0 commit comments

Comments
 (0)