[libcamera-devel] [PATCH v2] android: camera_device: Add existing check for ScalerCrop control
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Fri Mar 26 20:59:38 CET 2021
Hi Phi-Bang,
Thank you for the patch.
On Fri, Mar 26, 2021 at 08:52:12PM +0100, Phi-bang Nguyen wrote:
> The ScalerCrop control does not contain the existing check which can
>
> cause the camera HAL crash at boot. Fix it.
>
>
> Signed-off-by: Phi-Bang Nguyen <pnguyen at baylibre.com>
It looks like your mail client has destroyed the patch. Could you send
it with git-send-email (or any other option that you may have used
successfully in the patch, when posting a patch for the Linux kernel
maybe) ?
> ---
>
> src/android/camera_device.cpp | 9 ++++++---
>
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
>
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
>
> index ae693664..678bfff8 100644
>
> --- a/src/android/camera_device.cpp
>
> +++ b/src/android/camera_device.cpp
>
> @@ -1107,11 +1107,14 @@ const camera_metadata_t
> *CameraDevice::getStaticMetadata()
>
> * use the maximum and minimum crop rectangles to calculate the
>
> * digital zoom factor.
>
> */
>
> + float maxZoom = {1};
>
> const auto info = controlsInfo.find(&controls::ScalerCrop);
>
> - Rectangle min = info->second.min().get<Rectangle>();
>
> - Rectangle max = info->second.max().get<Rectangle>();
>
> - float maxZoom = std::min(1.0f * max.width / min.width,
>
> + if (info != controlsInfo.end()) {
>
> + Rectangle min = info->second.min().get<Rectangle>();
>
> + Rectangle max = info->second.max().get<Rectangle>();
>
> + maxZoom = std::min(1.0f * max.width / min.width,
>
> 1.0f * max.height / min.height);
>
> + }
>
> staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM,
>
> &maxZoom, 1);
>
> }
>
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list