diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2012-10-24 19:53:14 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-10-24 19:53:14 -0700 |
commit | 692c3e54c63aaaf7e9ef4d89761f98975bd34f33 (patch) | |
tree | 9d46780a58c66259f579663f756901820a80d815 | |
parent | a15ed9529e70caaf42aae78f9fe530abe38bcc1b (diff) | |
parent | 203836b7584ccb7787202578259d27d70a8a3ede (diff) | |
download | frameworks_av-692c3e54c63aaaf7e9ef4d89761f98975bd34f33.zip frameworks_av-692c3e54c63aaaf7e9ef4d89761f98975bd34f33.tar.gz frameworks_av-692c3e54c63aaaf7e9ef4d89761f98975bd34f33.tar.bz2 |
am 203836b7: am b8d6efba: Camera2: Don\'t hold locks while waiting to sync.
* commit '203836b7584ccb7787202578259d27d70a8a3ede':
Camera2: Don't hold locks while waiting to sync.
-rw-r--r-- | services/camera/libcameraservice/Camera2Client.cpp | 68 |
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 |