diff options
author | Ruben Brunk <rubenbrunk@google.com> | 2015-08-13 17:58:46 -0700 |
---|---|---|
committer | Ruben Brunk <rubenbrunk@google.com> | 2015-08-14 17:30:24 -0700 |
commit | c78ac26e3a65328fc0118f16ee76a800d0687eb7 (patch) | |
tree | 9009e37c981c7cbfdd106c44de2622edf1672a49 /services/camera/libcameraservice/api2 | |
parent | a09f8cf8c76fa946c4b91be059b420941abcdc3b (diff) | |
download | frameworks_av-c78ac26e3a65328fc0118f16ee76a800d0687eb7.zip frameworks_av-c78ac26e3a65328fc0118f16ee76a800d0687eb7.tar.gz frameworks_av-c78ac26e3a65328fc0118f16ee76a800d0687eb7.tar.bz2 |
Add experimental camera session prepare API.
Bug: 18949148
Change-Id: I8f73e68ea2e3acc60d98954106f364d13f439a82
Diffstat (limited to 'services/camera/libcameraservice/api2')
-rw-r--r-- | services/camera/libcameraservice/api2/CameraDeviceClient.cpp | 37 | ||||
-rw-r--r-- | services/camera/libcameraservice/api2/CameraDeviceClient.h | 3 |
2 files changed, 40 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp index c717a56..f6a0221 100644 --- a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp +++ b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp @@ -719,6 +719,43 @@ status_t CameraDeviceClient::prepare(int streamId) { return res; } +status_t CameraDeviceClient::prepare2(int maxCount, int streamId) { + ATRACE_CALL(); + ALOGV("%s", __FUNCTION__); + + status_t res = OK; + if ( (res = checkPid(__FUNCTION__) ) != OK) return res; + + Mutex::Autolock icl(mBinderSerializationLock); + + // Guard against trying to prepare non-created streams + ssize_t index = NAME_NOT_FOUND; + for (size_t i = 0; i < mStreamMap.size(); ++i) { + if (streamId == mStreamMap.valueAt(i)) { + index = i; + break; + } + } + + if (index == NAME_NOT_FOUND) { + ALOGW("%s: Camera %d: Invalid stream ID (%d) specified, no stream created yet", + __FUNCTION__, mCameraId, streamId); + return BAD_VALUE; + } + + if (maxCount <= 0) { + ALOGE("%s: Camera %d: Invalid maxCount (%d) specified, must be greater than 0.", + __FUNCTION__, mCameraId, maxCount); + return BAD_VALUE; + } + + // Also returns BAD_VALUE if stream ID was not valid, or stream already + // has been used + res = mDevice->prepare(maxCount, streamId); + + return res; +} + status_t CameraDeviceClient::tearDown(int streamId) { ATRACE_CALL(); ALOGV("%s", __FUNCTION__); diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.h b/services/camera/libcameraservice/api2/CameraDeviceClient.h index 1f8b39d..0b73f6c 100644 --- a/services/camera/libcameraservice/api2/CameraDeviceClient.h +++ b/services/camera/libcameraservice/api2/CameraDeviceClient.h @@ -114,6 +114,9 @@ public: // Tear down stream resources by freeing its unused buffers virtual status_t tearDown(int streamId); + // Prepare stream by preallocating up to maxCount of its buffers + virtual status_t prepare2(int maxCount, int streamId); + /** * Interface used by CameraService */ |