summaryrefslogtreecommitdiff
path: root/src/android/camera_device.h
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2021-05-10 12:05:59 +0200
committerJacopo Mondi <jacopo@jmondi.org>2021-06-14 12:26:27 +0200
commit10b31904d821d2467f02eee9ad1acf433d3731f2 (patch)
tree5050e6487a08324c5c150fac208b6b676d040870 /src/android/camera_device.h
parentebf8b5e7e064228897aeb18206d9bb93a5ff7e42 (diff)
android: Guard access to the camera state
Guard access to the camera state and the start/stop sequences with a mutex. Currently only stop() and the first call to processCaptureRequest() start and stop the camera, and they're not meant to race with each other. With the introduction of flush() the camera can be stopped concurrently to a processCaptureRequest() call, hence access to the camera state will need to be protected. Prepare for that by guarding the existing paths with a mutex. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/android/camera_device.h')
-rw-r--r--src/android/camera_device.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/android/camera_device.h b/src/android/camera_device.h
index 70c29755..117d829e 100644
--- a/src/android/camera_device.h
+++ b/src/android/camera_device.h
@@ -120,6 +120,7 @@ private:
CameraWorker worker_;
+ libcamera::Mutex stateMutex_; /* Protects access to the camera state. */
State state_;
std::shared_ptr<libcamera::Camera> camera_;