android: camera_device: Save capture settings unconditionally

As the Android framework sends to the camera device settings
incrementally (only the ones that change are updated), the CameraDevice
class in the Android camera HAL keeps a copy of the last received
settings to be able to apply controls to the libcamera Camera and to
populate metadata correctly.

When a valid 'camera3Request->settings' is provided, it gets saved to
'lastSettings_' but 'descriptor->settings_' is not initialized until
the next frame (assuming it does not contain more settings).

Fix this by assigning to 'descriptor->settings_' the last saved
settings unconditionally.

Signed-off-by: Fang Hui <hui.fang@nxp.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
This commit is contained in:
Fang Hui 2024-02-26 11:08:12 +08:00 committed by Jacopo Mondi
parent ed632bf37e
commit edef303bbe

View file

@ -952,7 +952,7 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
*/
if (camera3Request->settings)
lastSettings_ = camera3Request->settings;
else
descriptor->settings_ = lastSettings_;
LOG(HAL, Debug) << "Queueing request " << descriptor->request_->cookie()
@ -1108,6 +1108,8 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
}
if (state_ == State::Stopped) {
lastSettings_ = {};
ret = camera_->start();
if (ret) {
LOG(HAL, Error) << "Failed to start camera";