summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2012-10-24 17:30:30 -0700
committerEino-Ville Talvala <etalvala@google.com>2012-10-24 18:00:19 -0700
commitb8d6efba8b87e6eeb049651cb67f9827198e658e (patch)
tree3dd6470d3e23f97e570e64d5ccec21095be74440 /services
parentac1a450a76c2f42f66c876200cb724d1e93ef4c7 (diff)
downloadframeworks_av-b8d6efba8b87e6eeb049651cb67f9827198e658e.zip
frameworks_av-b8d6efba8b87e6eeb049651cb67f9827198e658e.tar.gz
frameworks_av-b8d6efba8b87e6eeb049651cb67f9827198e658e.tar.bz2
Camera2: Don't hold locks while waiting to sync.
Bug: 7409877 Change-Id: Ia3a0bc4f0ab4e19fca868ba04a870cf8e8ee7adb
Diffstat (limited to 'services')
-rw-r--r--services/camera/libcameraservice/Camera2Client.cpp68
1 files changed, 35 insertions, 33 deletions
diff --git a/services/camera/libcameraservice/Camera2Client.cpp b/services/camera/libcameraservice/Camera2Client.cpp
index 94630f9..e59a240 100644
--- a/services/camera/libcameraservice/Camera2Client.cpp
+++ b/services/camera/libcameraservice/Camera2Client.cpp
@@ -1068,42 +1068,44 @@ status_t Camera2Client::takePicture(int msgType) {
status_t res;
if ( (res = checkPid(__FUNCTION__) ) != OK) return res;
- SharedParameters::Lock l(mParameters);
- switch (l.mParameters.state) {
- case Parameters::DISCONNECTED:
- case Parameters::STOPPED:
- case Parameters::WAITING_FOR_PREVIEW_WINDOW:
- ALOGE("%s: Camera %d: Cannot take picture without preview enabled",
- __FUNCTION__, mCameraId);
- return INVALID_OPERATION;
- case Parameters::PREVIEW:
- // Good to go for takePicture
- res = commandStopFaceDetectionL(l.mParameters);
- if (res != OK) {
- ALOGE("%s: Camera %d: Unable to stop face detection for still capture",
+ {
+ SharedParameters::Lock l(mParameters);
+ switch (l.mParameters.state) {
+ case Parameters::DISCONNECTED:
+ case Parameters::STOPPED:
+ case Parameters::WAITING_FOR_PREVIEW_WINDOW:
+ ALOGE("%s: Camera %d: Cannot take picture without preview enabled",
__FUNCTION__, mCameraId);
- return res;
- }
- l.mParameters.state = Parameters::STILL_CAPTURE;
- break;
- case Parameters::RECORD:
- // Good to go for video snapshot
- l.mParameters.state = Parameters::VIDEO_SNAPSHOT;
- break;
- case Parameters::STILL_CAPTURE:
- case Parameters::VIDEO_SNAPSHOT:
- ALOGE("%s: Camera %d: Already taking a picture",
- __FUNCTION__, mCameraId);
- return INVALID_OPERATION;
- }
+ return INVALID_OPERATION;
+ case Parameters::PREVIEW:
+ // Good to go for takePicture
+ res = commandStopFaceDetectionL(l.mParameters);
+ if (res != OK) {
+ ALOGE("%s: Camera %d: Unable to stop face detection for still capture",
+ __FUNCTION__, mCameraId);
+ return res;
+ }
+ l.mParameters.state = Parameters::STILL_CAPTURE;
+ break;
+ case Parameters::RECORD:
+ // Good to go for video snapshot
+ l.mParameters.state = Parameters::VIDEO_SNAPSHOT;
+ break;
+ case Parameters::STILL_CAPTURE:
+ case Parameters::VIDEO_SNAPSHOT:
+ ALOGE("%s: Camera %d: Already taking a picture",
+ __FUNCTION__, mCameraId);
+ return INVALID_OPERATION;
+ }
- ALOGV("%s: Camera %d: Starting picture capture", __FUNCTION__, mCameraId);
+ ALOGV("%s: Camera %d: Starting picture capture", __FUNCTION__, mCameraId);
- res = mJpegProcessor->updateStream(l.mParameters);
- if (res != OK) {
- ALOGE("%s: Camera %d: Can't set up still image stream: %s (%d)",
- __FUNCTION__, mCameraId, strerror(-res), res);
- return res;
+ res = mJpegProcessor->updateStream(l.mParameters);
+ if (res != OK) {
+ ALOGE("%s: Camera %d: Can't set up still image stream: %s (%d)",
+ __FUNCTION__, mCameraId, strerror(-res), res);
+ return res;
+ }
}
// Need HAL to have correct settings before (possibly) triggering precapture