[libcamera-devel] [PATCH v5 7/8] android: Rename CameraDevice::mutex_
Jacopo Mondi
jacopo at jmondi.org
Tue Jun 8 17:16:32 CEST 2021
With the introduction of an additional mutex class member, the name of
the existing one is too generic.
Rename CameraDevice::mutex_ in CameraDevice::descriptorsMutex_ and use the
libcamera provided libcamera::Mutex type to align the style with the
rest of the code base.
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
Reviewed-by: Hirokazu Honda <hiroh at chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
src/android/camera_device.cpp | 4 ++--
src/android/camera_device.h | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index d3581c70c96b..b29c1edc9970 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -2009,7 +2009,7 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
worker_.queueRequest(descriptor.request_.get());
{
- MutexLocker lock(mutex_);
+ MutexLocker descriptorsLock(descriptorsMutex_);
descriptors_[descriptor.request_->cookie()] = std::move(descriptor);
}
@@ -2020,7 +2020,7 @@ void CameraDevice::requestComplete(Request *request)
{
decltype(descriptors_)::node_type node;
{
- MutexLocker lock(mutex_);
+ MutexLocker descriptorsLock(descriptorsMutex_);
auto it = descriptors_.find(request->cookie());
if (it == descriptors_.end()) {
/*
diff --git a/src/android/camera_device.h b/src/android/camera_device.h
index 117d829ec932..c949fa509ca4 100644
--- a/src/android/camera_device.h
+++ b/src/android/camera_device.h
@@ -24,6 +24,7 @@
#include "libcamera/internal/buffer.h"
#include "libcamera/internal/log.h"
#include "libcamera/internal/message.h"
+#include "libcamera/internal/thread.h"
#include "camera_metadata.h"
#include "camera_stream.h"
@@ -134,7 +135,7 @@ private:
std::map<int, libcamera::PixelFormat> formatsMap_;
std::vector<CameraStream> streams_;
- std::mutex mutex_; /* Protect descriptors_ */
+ libcamera::Mutex descriptorsMutex_; /* Protects descriptors_. */
std::map<uint64_t, Camera3RequestDescriptor> descriptors_;
std::string maker_;
--
2.31.1
More information about the libcamera-devel
mailing list