summaryrefslogtreecommitdiff
path: root/src/android/camera_device.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/android/camera_device.cpp')
-rw-r--r--src/android/camera_device.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 3346811b..d3581c70 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -800,6 +800,7 @@ void CameraDevice::close()
void CameraDevice::stop()
{
+ MutexLocker stateLock(stateMutex_);
if (state_ == State::Stopped)
return;
@@ -1900,17 +1901,21 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
if (!isValidRequest(camera3Request))
return -EINVAL;
- /* Start the camera if that's the first request we handle. */
- if (state_ == State::Stopped) {
- worker_.start();
+ {
+ MutexLocker stateLock(stateMutex_);
- int ret = camera_->start();
- if (ret) {
- LOG(HAL, Error) << "Failed to start camera";
- return ret;
- }
+ /* Start the camera if that's the first request we handle. */
+ if (state_ == State::Stopped) {
+ worker_.start();
- state_ = State::Running;
+ int ret = camera_->start();
+ if (ret) {
+ LOG(HAL, Error) << "Failed to start camera";
+ return ret;
+ }
+
+ state_ = State::Running;
+ }
}
/*