[libcamera-devel,v3,5/5] android: camera_device: Return AE FPS range
diff mbox series

Message ID 20210222105222.393677-6-jacopo@jmondi.org
State Accepted
Headers show
Series
  • android: Report frame durations
Related show

Commit Message

Jacopo Mondi Feb. 22, 2021, 10:52 a.m. UTC
The result metadata reports an arbitrary {30, 30} FPS range for the
AE algorithm.

The actual FPS range should be returned in the Request::metadata, but
as libcamera currently does not support that feature temporarily work
around the issue and return the FPS range requested by the camera
framework.

While at it, create a 'settings' reference to descriptor->settings_
and use it in multiple locations.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/android/camera_device.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Laurent Pinchart March 8, 2021, 11:51 p.m. UTC | #1
Hi Jacopo,

Thank you for the patch.

On Mon, Feb 22, 2021 at 11:52:22AM +0100, Jacopo Mondi wrote:
> The result metadata reports an arbitrary {30, 30} FPS range for the
> AE algorithm.
> 
> The actual FPS range should be returned in the Request::metadata, but
> as libcamera currently does not support that feature temporarily work
> around the issue and return the FPS range requested by the camera
> framework.
> 
> While at it, create a 'settings' reference to descriptor->settings_
> and use it in multiple locations.

I think this paragraph should be dropped as you don't do so anymore (at
least not in this patch). Other than that, the patch looks good.

> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  src/android/camera_device.cpp | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index c0939eaf27ac..c2fe2787fa74 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -2093,9 +2093,14 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,
>  	value = ANDROID_CONTROL_AE_MODE_ON;
>  	resultMetadata->addEntry(ANDROID_CONTROL_AE_MODE, &value, 1);
>  
> -	std::vector<int32_t> aeFpsTarget = { 30, 30 };
> -	resultMetadata->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE,
> -				 aeFpsTarget.data(), aeFpsTarget.size());
> +	if (settings.getEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, &entry))
> +		/*
> +		 * \todo Retrieve the AE FPS range from the libcamera metadata.
> +		 * As libcamera does not support that control, as a temporary
> +		 * workaround return what the framework asked.
> +		 */
> +		resultMetadata->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE,
> +					 entry.data.i32, 2);
>  
>  	value = ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE;
>  	found = settings.getEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, &entry);

Patch
diff mbox series

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index c0939eaf27ac..c2fe2787fa74 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -2093,9 +2093,14 @@  CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,
 	value = ANDROID_CONTROL_AE_MODE_ON;
 	resultMetadata->addEntry(ANDROID_CONTROL_AE_MODE, &value, 1);
 
-	std::vector<int32_t> aeFpsTarget = { 30, 30 };
-	resultMetadata->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE,
-				 aeFpsTarget.data(), aeFpsTarget.size());
+	if (settings.getEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, &entry))
+		/*
+		 * \todo Retrieve the AE FPS range from the libcamera metadata.
+		 * As libcamera does not support that control, as a temporary
+		 * workaround return what the framework asked.
+		 */
+		resultMetadata->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE,
+					 entry.data.i32, 2);
 
 	value = ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE;
 	found = settings.getEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, &entry);