summaryrefslogtreecommitdiff
path: root/src/android
diff options
context:
space:
mode:
Diffstat (limited to 'src/android')
-rw-r--r--src/android/camera_device.h1
-rw-r--r--src/android/camera_hal_manager.h7
-rw-r--r--src/android/camera_request.h4
-rw-r--r--src/android/camera_stream.cpp12
-rw-r--r--src/android/camera_stream.h3
5 files changed, 11 insertions, 16 deletions
diff --git a/src/android/camera_device.h b/src/android/camera_device.h
index 51fe7da2..bda0b376 100644
--- a/src/android/camera_device.h
+++ b/src/android/camera_device.h
@@ -9,7 +9,6 @@
#include <map>
#include <memory>
-#include <mutex>
#include <queue>
#include <vector>
diff --git a/src/android/camera_hal_manager.h b/src/android/camera_hal_manager.h
index 192f2fc5..cc310f90 100644
--- a/src/android/camera_hal_manager.h
+++ b/src/android/camera_hal_manager.h
@@ -8,7 +8,6 @@
#pragma once
#include <map>
-#include <mutex>
#include <stddef.h>
#include <tuple>
#include <vector>
@@ -18,6 +17,7 @@
#include <system/camera_metadata.h>
#include <libcamera/base/class.h>
+#include <libcamera/base/thread.h>
#include <libcamera/camera_manager.h>
@@ -44,9 +44,6 @@ public:
private:
LIBCAMERA_DISABLE_COPY_AND_MOVE(CameraHalManager)
- using Mutex = std::mutex;
- using MutexLocker = std::unique_lock<std::mutex>;
-
static constexpr unsigned int firstExternalCameraId_ = 1000;
CameraHalManager();
@@ -64,7 +61,7 @@ private:
const camera_module_callbacks_t *callbacks_;
std::vector<std::unique_ptr<CameraDevice>> cameras_;
std::map<std::string, unsigned int> cameraIdsMap_;
- Mutex mutex_;
+ libcamera::Mutex mutex_;
unsigned int numInternalCameras_;
unsigned int nextExternalCameraId_;
diff --git a/src/android/camera_request.h b/src/android/camera_request.h
index f3cb6d64..88d501a8 100644
--- a/src/android/camera_request.h
+++ b/src/android/camera_request.h
@@ -9,10 +9,10 @@
#include <map>
#include <memory>
-#include <mutex>
#include <vector>
#include <libcamera/base/class.h>
+#include <libcamera/base/thread.h>
#include <libcamera/camera.h>
#include <libcamera/framebuffer.h>
@@ -58,7 +58,7 @@ public:
/* Keeps track of streams requiring post-processing. */
std::map<CameraStream *, StreamBuffer *> pendingStreamsToProcess_;
- std::mutex streamsProcessMutex_;
+ libcamera::Mutex streamsProcessMutex_;
Camera3RequestDescriptor(libcamera::Camera *camera,
const camera3_capture_request_t *camera3Request);
diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp
index 9023c13c..5a62b7cd 100644
--- a/src/android/camera_stream.cpp
+++ b/src/android/camera_stream.cpp
@@ -119,7 +119,7 @@ int CameraStream::configure()
if (type_ == Type::Internal) {
allocator_ = std::make_unique<FrameBufferAllocator>(cameraDevice_->camera());
- mutex_ = std::make_unique<std::mutex>();
+ mutex_ = std::make_unique<Mutex>();
int ret = allocator_->allocate(stream());
if (ret < 0)
@@ -208,7 +208,7 @@ FrameBuffer *CameraStream::getBuffer()
if (!allocator_)
return nullptr;
- std::lock_guard<std::mutex> locker(*mutex_);
+ MutexLocker locker(*mutex_);
if (buffers_.empty()) {
LOG(HAL, Error) << "Buffer underrun";
@@ -226,7 +226,7 @@ void CameraStream::putBuffer(FrameBuffer *buffer)
if (!allocator_)
return;
- std::lock_guard<std::mutex> locker(*mutex_);
+ MutexLocker locker(*mutex_);
buffers_.push_back(buffer);
}
@@ -239,7 +239,7 @@ CameraStream::PostProcessorWorker::PostProcessorWorker(PostProcessor *postProces
CameraStream::PostProcessorWorker::~PostProcessorWorker()
{
{
- libcamera::MutexLocker lock(mutex_);
+ MutexLocker lock(mutex_);
state_ = State::Stopped;
}
@@ -250,7 +250,7 @@ CameraStream::PostProcessorWorker::~PostProcessorWorker()
void CameraStream::PostProcessorWorker::start()
{
{
- libcamera::MutexLocker lock(mutex_);
+ MutexLocker lock(mutex_);
ASSERT(state_ != State::Running);
state_ = State::Running;
}
@@ -308,7 +308,7 @@ void CameraStream::PostProcessorWorker::run()
void CameraStream::PostProcessorWorker::flush()
{
- libcamera::MutexLocker lock(mutex_);
+ MutexLocker lock(mutex_);
state_ = State::Flushing;
lock.unlock();
diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h
index e4808369..adb5a37d 100644
--- a/src/android/camera_stream.h
+++ b/src/android/camera_stream.h
@@ -8,7 +8,6 @@
#pragma once
#include <memory>
-#include <mutex>
#include <queue>
#include <vector>
@@ -173,7 +172,7 @@ private:
* The class has to be MoveConstructible as instances are stored in
* an std::vector in CameraDevice.
*/
- std::unique_ptr<std::mutex> mutex_;
+ std::unique_ptr<libcamera::Mutex> mutex_;
std::unique_ptr<PostProcessor> postProcessor_;
std::unique_ptr<PostProcessorWorker> worker_;