summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHirokazu Honda <hiroh@chromium.org>2021-12-01 16:53:44 +0900
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-12-01 13:46:52 +0200
commit5e0d3a35170f9fc8183507d5c272d19937d31f1c (patch)
treea1f929c444a5a5f38b947ba7bd1e846d9fc4bd02
parentd5fb676ed524863371d6916aa9aa4408185bcb3e (diff)
android: camera_stream: Protect buffers initialization by mutex_
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@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/android/camera_stream.cpp1
1 files changed, 1 insertions, 0 deletions
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());