diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2013-09-06 09:32:43 -0700 |
---|---|---|
committer | Eino-Ville Talvala <etalvala@google.com> | 2013-10-02 18:11:21 -0700 |
commit | f1e98d857ec377f2c9b916073d40732e6ebb7ced (patch) | |
tree | 2a435e723f17c0c7b3e6db323d68be6cfb7d5c66 /services/camera/libcameraservice/api2 | |
parent | f05e50eb06d3f70e50fa7f44c1fd32128033b49d (diff) | |
download | frameworks_av-f1e98d857ec377f2c9b916073d40732e6ebb7ced.zip frameworks_av-f1e98d857ec377f2c9b916073d40732e6ebb7ced.tar.gz frameworks_av-f1e98d857ec377f2c9b916073d40732e6ebb7ced.tar.bz2 |
Camera API 2, Device 2/3: Implement idle and shutter callbacks
- Update callback Binder interface
- Rename frameId to be requestId to be consistent and disambiguate
from frameNumber.
- Implement shutter callback from HAL2/3 notify()
- Add in-flight tracking to HAL2
- Add requestId to in-flight tracking
- Report requestId from shutter callback
- Implement idle callback from HAL3 process_capture_result
- Add new idle tracker thread
- Update all idle waiting to use the tracker
- Add reporting from request thread, all streams to tracker
- Remove existing idle waiting infrastructure
Bug: 10549462
Change-Id: I867bfc248e3848c50e71527e3561fe92dc037958
Diffstat (limited to 'services/camera/libcameraservice/api2')
-rw-r--r-- | services/camera/libcameraservice/api2/CameraDeviceClient.cpp | 43 | ||||
-rw-r--r-- | services/camera/libcameraservice/api2/CameraDeviceClient.h | 12 |
2 files changed, 40 insertions, 15 deletions
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp index 76d44bf..72126c1 100644 --- a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp +++ b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp @@ -45,14 +45,6 @@ CameraDeviceClientBase::CameraDeviceClientBase( cameraId, cameraFacing, clientPid, clientUid, servicePid), mRemoteCallback(remoteCallback) { } -void CameraDeviceClientBase::notifyError() { - // Thread safe. Don't bother locking. - sp<ICameraDeviceCallbacks> remoteCb = mRemoteCallback; - - if (remoteCb != 0) { - remoteCb->notifyCallback(CAMERA_MSG_ERROR, CAMERA_ERROR_RELEASED, 0); - } -} // Interface used by CameraService @@ -164,7 +156,6 @@ status_t CameraDeviceClient::submitRequest(sp<CaptureRequest> request, metadata.update(ANDROID_REQUEST_OUTPUT_STREAMS, &outputStreamIds[0], outputStreamIds.size()); - // TODO: @hide ANDROID_REQUEST_ID, or use another request token int32_t requestId = mRequestIdCounter++; metadata.update(ANDROID_REQUEST_ID, &requestId, /*size*/1); ALOGV("%s: Camera %d: Submitting request with ID %d", @@ -501,6 +492,34 @@ status_t CameraDeviceClient::dump(int fd, const Vector<String16>& args) { return dumpDevice(fd, args); } + +void CameraDeviceClient::notifyError() { + // Thread safe. Don't bother locking. + sp<ICameraDeviceCallbacks> remoteCb = getRemoteCallback(); + + if (remoteCb != 0) { + remoteCb->onDeviceError(ICameraDeviceCallbacks::ERROR_CAMERA_DEVICE); + } +} + +void CameraDeviceClient::notifyIdle() { + // Thread safe. Don't bother locking. + sp<ICameraDeviceCallbacks> remoteCb = getRemoteCallback(); + + if (remoteCb != 0) { + remoteCb->onDeviceIdle(); + } +} + +void CameraDeviceClient::notifyShutter(int requestId, + nsecs_t timestamp) { + // Thread safe. Don't bother locking. + sp<ICameraDeviceCallbacks> remoteCb = getRemoteCallback(); + if (remoteCb != 0) { + remoteCb->onCaptureStarted(requestId, timestamp); + } +} + // TODO: refactor the code below this with IProCameraUser. // it's 100% copy-pasted, so lets not change it right now to make it easier. @@ -532,8 +551,8 @@ void CameraDeviceClient::detachDevice() { } /** Device-related methods */ -void CameraDeviceClient::onFrameAvailable(int32_t frameId, - const CameraMetadata& frame) { +void CameraDeviceClient::onFrameAvailable(int32_t requestId, + const CameraMetadata& frame) { ATRACE_CALL(); ALOGV("%s", __FUNCTION__); @@ -541,7 +560,7 @@ void CameraDeviceClient::onFrameAvailable(int32_t frameId, sp<ICameraDeviceCallbacks> remoteCb = mRemoteCallback; if (remoteCb != NULL) { ALOGV("%s: frame = %p ", __FUNCTION__, &frame); - remoteCb->onResultReceived(frameId, frame); + remoteCb->onResultReceived(requestId, frame); } } diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.h b/services/camera/libcameraservice/api2/CameraDeviceClient.h index b490924..b9c16aa 100644 --- a/services/camera/libcameraservice/api2/CameraDeviceClient.h +++ b/services/camera/libcameraservice/api2/CameraDeviceClient.h @@ -45,8 +45,6 @@ protected: uid_t clientUid, int servicePid); - virtual void notifyError(); - sp<ICameraDeviceCallbacks> mRemoteCallback; }; @@ -112,11 +110,19 @@ public: virtual status_t dump(int fd, const Vector<String16>& args); /** + * Device listener interface + */ + + virtual void notifyIdle(); + virtual void notifyError(); + virtual void notifyShutter(int requestId, nsecs_t timestamp); + + /** * Interface used by independent components of CameraDeviceClient. */ protected: /** FilteredListener implementation **/ - virtual void onFrameAvailable(int32_t frameId, + virtual void onFrameAvailable(int32_t requestId, const CameraMetadata& frame); virtual void detachDevice(); |