[libcamera-devel] [PATCH 4/9] libcamera: camera_manager: Enforce unique camera IDs
Niklas Söderlund
niklas.soderlund at ragnatech.se
Sat Jul 18 15:23:19 CEST 2020
Before adding a camera to the CameraManager ensure the camera ID is
unique.
Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
---
src/libcamera/camera_manager.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
index f60491d2c1a7500f..4d23d601e1fc8a28 100644
--- a/src/libcamera/camera_manager.cpp
+++ b/src/libcamera/camera_manager.cpp
@@ -183,6 +183,13 @@ void CameraManager::Private::addCamera(std::shared_ptr<Camera> camera,
<< camera->name() << "'";
break;
}
+
+ if (c->id() == camera->id()) {
+ LOG(Camera, Error)
+ << "Skipped registering camera with duplicated ID '"
+ << camera->id() << "'";
+ return;
+ }
}
cameras_.push_back(std::move(camera));
--
2.27.0
More information about the libcamera-devel
mailing list