[libcamera-devel] [PATCH v3 05/10] android: camera_device: Store results metadata into Camera3RequestDescriptor

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Sep 20 21:11:12 CEST 2021


Hi Uman,

Thank you for the patch.

On Mon, Sep 20, 2021 at 11:07:47PM +0530, Umang Jain wrote:
> Store metadata which is sent as capture results into the
> Camera3RequestDescriptor. This is will remove the need to send the

s/is will/will/

> result metadata pointer separately to CameraStream::process().
> In the subsequent commit, a Camera3RequestDescriptor pointer
> will be passed to CameraStream::process() and the result metadata
> can be directly accessed from there.

I'd have squashed 05/10 and 06/10 together, as this patch alone is very
small, and the combination of the two shows the intent of 05/10 better.
Up to you.

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> Signed-off-by: Umang Jain <umang.jain at ideasonboard.com>
> ---
>  src/android/camera_device.cpp | 6 ++++--
>  src/android/camera_device.h   | 1 +
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index 3d6a2bed..1ae4ac73 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -1131,6 +1131,8 @@ void CameraDevice::requestComplete(Request *request)
>  		resultMetadata = std::make_unique<CameraMetadata>(0, 0);
>  	}
>  
> +	descriptor->resultMetadata_ = std::move(resultMetadata);
> +
>  	/* Handle any JPEG compression. */
>  	for (camera3_stream_buffer_t &buffer : descriptor->buffers_) {
>  		CameraStream *cameraStream =
> @@ -1150,7 +1152,7 @@ void CameraDevice::requestComplete(Request *request)
>  
>  		int ret = cameraStream->process(src, *buffer.buffer,
>  						descriptor->settings_,
> -						resultMetadata.get());
> +						descriptor->resultMetadata_.get());
>  		/*
>  		 * Return the FrameBuffer to the CameraStream now that we're
>  		 * done processing it.
> @@ -1165,7 +1167,7 @@ void CameraDevice::requestComplete(Request *request)
>  		}
>  	}
>  
> -	captureResult.result = resultMetadata->get();
> +	captureResult.result = descriptor->resultMetadata_->get();
>  	callbacks_->process_capture_result(callbacks_, &captureResult);
>  
>  	descriptors_.pop_front();
> diff --git a/src/android/camera_device.h b/src/android/camera_device.h
> index 59d6cd39..b2871e52 100644
> --- a/src/android/camera_device.h
> +++ b/src/android/camera_device.h
> @@ -47,6 +47,7 @@ struct Camera3RequestDescriptor {
>  	std::vector<std::unique_ptr<libcamera::FrameBuffer>> frameBuffers_;
>  	CameraMetadata settings_;
>  	std::unique_ptr<CaptureRequest> request_;
> +	std::unique_ptr<CameraMetadata> resultMetadata_;
>  };
>  
>  class CameraDevice : protected libcamera::Loggable

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list