[libcamera-devel] [PATCH v3 01/11] android: camera_device: Refuse unsupported formats
Niklas Söderlund
niklas.soderlund at ragnatech.se
Thu Sep 10 12:29:16 CEST 2020
Hi Jacopo,
Thanks for your patch.
On 2020-09-08 15:41:32 +0200, Jacopo Mondi wrote:
> The current implementation of CameraDevice::initializeStreamConfigurations()
> fails if an image format marked as mandatory is not supported by the
> libcamera::Camera device, but erroneously accepts non-mandatory
> non-supported formats in the list of accepted ones.
>
> Fix this by ignoring non supported image formats which are not marked as
> mandatory.
>
> Reviewed-by: Hirokazu Honda <hiroh at chromium.org>
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
> src/android/camera_device.cpp | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index 25829918cd29..28fb3868c082 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -392,10 +392,16 @@ int CameraDevice::initializeStreamConfigurations()
> break;
> }
> }
> - if (camera3Format.mandatory && !mappedFormat.isValid()) {
> - LOG(HAL, Error) << "Failed to map Android format "
> - << camera3Format.name << " ("
> - << utils::hex(androidFormat) << ")";
> +
> + if (!mappedFormat.isValid()) {
> + /* If the format is not mandatory, skip it. */
> + if (!camera3Format.mandatory)
> + continue;
> +
> + LOG(HAL, Error)
> + << "Failed to map mandatory Android format "
> + << camera3Format.name << " ("
> + << utils::hex(androidFormat) << "): aborting";
> return -EINVAL;
> }
>
> --
> 2.28.0
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
--
Regards,
Niklas Söderlund
More information about the libcamera-devel
mailing list