[libcamera-devel] [PATCH 1/2] android: camera_device: Fix sensor frame duration

Niklas Söderlund niklas.soderlund at ragnatech.se
Fri May 21 13:51:06 CEST 2021


Hi Paul,

Thanks for your work.

On 2021-05-21 19:55:33 +0900, Paul Elder wrote:
> The sensor frame duration should be set by IPA. Get the information for
> the result metadata from libcamera.
> 
> Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
> ---
>  src/android/camera_device.cpp | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index b32e8be5..779ce554 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -2252,6 +2252,16 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons
>  		resultMetadata->addEntry(ANDROID_SENSOR_EXPOSURE_TIME, exposure);
>  	}
>  
> +	if (metadata.contains(controls::FrameDurations)) {
> +		Span<const int64_t> durations =
> +			metadata.get(controls::FrameDurations);
> +		if (durations[0] == durations[1]) {

Do we need a todo here to expand this to work with min/max frame 
durations at a later stage?

> +			int64_t duration = durations[0] * 1000;
> +			resultMetadata->addEntry(ANDROID_SENSOR_FRAME_DURATION,
> +						 duration);
> +		}
> +	}
> +
>  	if (metadata.contains(controls::ScalerCrop)) {
>  		Rectangle crop = metadata.get(controls::ScalerCrop);
>  		int32_t cropRect[] = {
> -- 
> 2.27.0
> 

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list