[libcamera-devel] [RFC 3/7] android: camera_device: Check correct stream format

Niklas Söderlund niklas.soderlund at ragnatech.se
Fri Sep 4 08:13:53 CEST 2020


Hi Jacopo,

Thanks for your work.

On 2020-09-02 15:08:42 +0200, Jacopo Mondi wrote:
> When iterating the camera3_stream_t received from the Android camera
> framework to identify the MJPEG streams, the format check was performed
> on the CameraStream created when iterating the non-MJPEG streams and not
> on the format actually requested by Android.
> 
> Fix this by checking the camera3_stream format.
> 
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>

Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>

> ---
>  src/android/camera_device.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index 5a70db832aa5..01f4b3a45566 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -1230,9 +1230,10 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
>  	/* Now handle MJPEG streams, adding a new stream if required. */
>  	for (unsigned int i = 0; i < stream_list->num_streams; ++i) {
>  		camera3_stream_t *stream = stream_list->streams[i];
> +		PixelFormat format = toPixelFormat(stream->format);
>  		bool match = false;
>  
> -		if (streams_[i].format != formats::MJPEG)
> +		if (format != formats::MJPEG)
>  			continue;
>  
>  		/* Search for a compatible stream */
> -- 
> 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