diff options
author | Zhijun He <zhijunhe@google.com> | 2014-07-07 17:05:38 -0700 |
---|---|---|
committer | Zhijun He <zhijunhe@google.com> | 2014-07-08 14:13:16 +0000 |
commit | 0ea8fa4ccbf9b2b179370b983f3887d3daf2381f (patch) | |
tree | 7c513124746228beab5a262424fcbdd2a00018c7 /services/camera/libcameraservice | |
parent | d8cbe4a024ef54adf043b6ea31fa22271b8b2c51 (diff) | |
download | frameworks_av-0ea8fa4ccbf9b2b179370b983f3887d3daf2381f.zip frameworks_av-0ea8fa4ccbf9b2b179370b983f3887d3daf2381f.tar.gz frameworks_av-0ea8fa4ccbf9b2b179370b983f3887d3daf2381f.tar.bz2 |
Camera3: Add capture intent for ZSL capture
Also fix the warning condition in input buffer return path.
Change-Id: I90e9edc1db9f1de87bc8936000b00c3306160c71
Diffstat (limited to 'services/camera/libcameraservice')
4 files changed, 56 insertions, 10 deletions
diff --git a/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp b/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp index 99abced..911f55a 100644 --- a/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp +++ b/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp @@ -89,8 +89,26 @@ status_t StreamingProcessor::updatePreviewRequest(const Parameters ¶ms) { Mutex::Autolock m(mMutex); if (mPreviewRequest.entryCount() == 0) { - res = device->createDefaultRequest(CAMERA2_TEMPLATE_PREVIEW, - &mPreviewRequest); + sp<Camera2Client> client = mClient.promote(); + if (client == 0) { + ALOGE("%s: Camera %d: Client does not exist", __FUNCTION__, mId); + return INVALID_OPERATION; + } + + // Use CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG for ZSL streaming case. + if (client->getCameraDeviceVersion() >= CAMERA_DEVICE_API_VERSION_3_0) { + if (params.zslMode && !params.recordingHint) { + res = device->createDefaultRequest(CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG, + &mPreviewRequest); + } else { + res = device->createDefaultRequest(CAMERA3_TEMPLATE_PREVIEW, + &mPreviewRequest); + } + } else { + res = device->createDefaultRequest(CAMERA2_TEMPLATE_PREVIEW, + &mPreviewRequest); + } + if (res != OK) { ALOGE("%s: Camera %d: Unable to create default preview request: " "%s (%d)", __FUNCTION__, mId, strerror(-res), res); diff --git a/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp b/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp index ae537e2..79f75a5 100644 --- a/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp +++ b/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp @@ -290,18 +290,45 @@ status_t ZslProcessor3::pushToReprocess(int32_t requestId) { uint8_t requestType = ANDROID_REQUEST_TYPE_REPROCESS; res = request.update(ANDROID_REQUEST_TYPE, &requestType, 1); + if (res != OK) { + ALOGE("%s: Unable to update request type", + __FUNCTION__); + return INVALID_OPERATION; + } + int32_t inputStreams[1] = { mZslStreamId }; - if (res == OK) request.update(ANDROID_REQUEST_INPUT_STREAMS, + res = request.update(ANDROID_REQUEST_INPUT_STREAMS, inputStreams, 1); + if (res != OK) { + ALOGE("%s: Unable to update request input streams", + __FUNCTION__); + return INVALID_OPERATION; + } + + uint8_t captureIntent = + static_cast<uint8_t>(ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE); + res = request.update(ANDROID_CONTROL_CAPTURE_INTENT, + &captureIntent, 1); + if (res != OK ) { + ALOGE("%s: Unable to update request capture intent", + __FUNCTION__); + return INVALID_OPERATION; + } + // TODO: Shouldn't we also update the latest preview frame? int32_t outputStreams[1] = { client->getCaptureStreamId() }; - if (res == OK) request.update(ANDROID_REQUEST_OUTPUT_STREAMS, + res = request.update(ANDROID_REQUEST_OUTPUT_STREAMS, outputStreams, 1); + if (res != OK) { + ALOGE("%s: Unable to update request output streams", + __FUNCTION__); + return INVALID_OPERATION; + } + res = request.update(ANDROID_REQUEST_ID, &requestId, 1); - if (res != OK ) { ALOGE("%s: Unable to update frame to a reprocess request", __FUNCTION__); diff --git a/services/camera/libcameraservice/common/CameraDeviceBase.h b/services/camera/libcameraservice/common/CameraDeviceBase.h index 7597b10..c7bd886 100644 --- a/services/camera/libcameraservice/common/CameraDeviceBase.h +++ b/services/camera/libcameraservice/common/CameraDeviceBase.h @@ -26,6 +26,7 @@ #include <camera/camera2/ICameraDeviceCallbacks.h> #include "hardware/camera2.h" +#include "hardware/camera3.h" #include "camera/CameraMetadata.h" #include "camera/CaptureResult.h" diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp index bbb1e1c..6ceb9d4 100644 --- a/services/camera/libcameraservice/device3/Camera3Device.cpp +++ b/services/camera/libcameraservice/device3/Camera3Device.cpp @@ -1929,11 +1929,11 @@ void Camera3Device::processCaptureResult(const camera3_capture_result *result) { ALOGE("%s: RequestThread: Can't return input buffer for frame %d to" " its stream:%s (%d)", __FUNCTION__, frameNumber, strerror(-res), res); - } else { - ALOGW("%s: Input buffer should be NULL if there is no input" - " buffer sent in the request", - __FUNCTION__); - } + } + } else { + ALOGW("%s: Input buffer should be NULL if there is no input" + " buffer sent in the request, skipping input buffer return.", + __FUNCTION__); } } |