[libcamera-devel] [PATCH RFC 4/7] android: camera_device: support when no Direct stream is found

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sun Sep 24 20:51:45 CEST 2023


Hi Mattijs,

Thank you for the patch.

On Fri, Sep 15, 2023 at 09:57:28AM +0200, Mattijs Korpershoek via libcamera-devel wrote:
> As the comment states, it's possible that the first element in
> streamConfig.streams is a Internal stream.
> In that case sourceStream stays a nullptr and all the Mapped streams are
> mapped towards a nullptr.
> 
> Make sure that the Mapped streams are mapped to an Internal stream in case
> that's the first element.
> 
> Signed-off-by: Mattijs Korpershoek <mkorpershoek at baylibre.com>
> ---
>  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 1f7ce4402b63..d34bae715a47 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -724,7 +724,8 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
>  			 * be used when constructing the subsequent mapped
>  			 * streams.
>  			 */
> -			if (stream.type == CameraStream::Type::Direct)
> +			if (stream.type == CameraStream::Type::Direct ||
> +			    stream.type == CameraStream::Type::Internal)

This looks good, but I think the above comment should be updated.

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 25cedd44446d..130b04ffed6d 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -718,11 +718,10 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)

 			/*
 			 * The streamConfig.streams vector contains as its first
-			 * element a Direct (or Internal) stream, and then an
-			 * optional set of Mapped streams derived from the
-			 * Direct stream. Cache the Direct stream pointer, to
-			 * be used when constructing the subsequent mapped
-			 * streams.
+			 * element a Direct or Internal stream, and then an
+			 * optional set of Mapped streams derived from that
+			 * stream. Cache the source stream pointer, to be used
+			 * when constructing the subsequent mapped streams.
 			 */
 			if (stream.type == CameraStream::Type::Direct)
 				sourceStream = &streams_.back();

With this,

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

>  				sourceStream = &streams_.back();
>  		}
>  	}
> 

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list