mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-23 00:25:07 +03:00
android: Instantiate CameraDevice after checking HAL config validity
Currently CameraDevice wrapper is created first and then HAL config validity is checked. If the validity checks fail, the code path will simply return, in which case, creating CameraDevice seems a futile exercise. This patch defers the creation of CameraDevice wrapper until the HAL config validity is checked for internal cameras. This will also enable us to infer a few things beforehand, by reading the config file before creating the CameraDevice wrapper. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
parent
c615807bc4
commit
cc0a50cddf
1 changed files with 3 additions and 3 deletions
|
@ -133,9 +133,6 @@ void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a CameraDevice instance to wrap the libcamera Camera. */
|
|
||||||
std::unique_ptr<CameraDevice> camera = CameraDevice::create(id, cam);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The configuration file must be valid, and contain a corresponding
|
* The configuration file must be valid, and contain a corresponding
|
||||||
* entry for internal cameras. External cameras can be initialized
|
* entry for internal cameras. External cameras can be initialized
|
||||||
|
@ -155,6 +152,9 @@ void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create a CameraDevice instance to wrap the libcamera Camera. */
|
||||||
|
std::unique_ptr<CameraDevice> camera = CameraDevice::create(id, cam);
|
||||||
|
|
||||||
int ret = camera->initialize(cameraConfigData);
|
int ret = camera->initialize(cameraConfigData);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
LOG(HAL, Error) << "Failed to initialize camera: " << cam->id();
|
LOG(HAL, Error) << "Failed to initialize camera: " << cam->id();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue