[libcamera-devel] [PATCH v2 07/11] android: camera_stream: Protect buffers initialization by mutex_
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Tue Nov 30 05:21:25 CET 2021
Hi Hiro,
Thank you for the patch.
On Mon, Nov 29, 2021 at 08:44:49PM +0900, Hirokazu Honda wrote:
> The initialization on buffers_ in CameraStrean::configure() is not
> protected by mutex_. It is no problem because configure() is not
> invoked simultaneously while other functions are called. This
> protects it to keep the thread safety consistency for buffers access.
>
> Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
> src/android/camera_stream.cpp | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp
> index 5a62b7cd..2181d094 100644
> --- a/src/android/camera_stream.cpp
> +++ b/src/android/camera_stream.cpp
> @@ -125,6 +125,7 @@ int CameraStream::configure()
> if (ret < 0)
> return ret;
>
> + MutexLocker lock(*mutex_);
> /* Save a pointer to the reserved frame buffers */
> for (const auto &frameBuffer : allocator_->buffers(stream()))
> buffers_.push_back(frameBuffer.get());
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list