[libcamera-devel,RFC,4/7] android: camera_device: support when no Direct stream is found
diff mbox series

Message ID 20230915-libyuv-convert-v1-4-1e5bcf68adac@baylibre.com
State New
Headers show
Series
  • android: add YUYV->NV12 conversion via libyuv
Related show

Commit Message

Mattijs Korpershoek Sept. 15, 2023, 7:57 a.m. UTC
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@baylibre.com>
---
 src/android/camera_device.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Laurent Pinchart Sept. 24, 2023, 6:51 p.m. UTC | #1
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@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@ideasonboard.com>

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

Patch
diff mbox series

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)
 				sourceStream = &streams_.back();
 		}
 	}