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 /camera/camera2 | |
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 'camera/camera2')
-rw-r--r-- | camera/camera2/ICameraDeviceCallbacks.cpp | 68 |
1 files changed, 51 insertions, 17 deletions
diff --git a/camera/camera2/ICameraDeviceCallbacks.cpp b/camera/camera2/ICameraDeviceCallbacks.cpp index 3cec1f4..613358a 100644 --- a/camera/camera2/ICameraDeviceCallbacks.cpp +++ b/camera/camera2/ICameraDeviceCallbacks.cpp @@ -32,7 +32,9 @@ namespace android { enum { - NOTIFY_CALLBACK = IBinder::FIRST_CALL_TRANSACTION, + CAMERA_ERROR = IBinder::FIRST_CALL_TRANSACTION, + CAMERA_IDLE, + CAPTURE_STARTED, RESULT_RECEIVED, }; @@ -44,19 +46,37 @@ public: { } - // generic callback from camera service to app - void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2) + void onDeviceError(CameraErrorCode errorCode) { - ALOGV("notifyCallback"); + ALOGV("onDeviceError"); Parcel data, reply; data.writeInterfaceToken(ICameraDeviceCallbacks::getInterfaceDescriptor()); - data.writeInt32(msgType); - data.writeInt32(ext1); - data.writeInt32(ext2); - remote()->transact(NOTIFY_CALLBACK, data, &reply, IBinder::FLAG_ONEWAY); + data.writeInt32(static_cast<int32_t>(errorCode)); + remote()->transact(CAMERA_ERROR, data, &reply, IBinder::FLAG_ONEWAY); data.writeNoException(); } + void onDeviceIdle() + { + ALOGV("onDeviceIdle"); + Parcel data, reply; + data.writeInterfaceToken(ICameraDeviceCallbacks::getInterfaceDescriptor()); + remote()->transact(CAMERA_IDLE, data, &reply, IBinder::FLAG_ONEWAY); + data.writeNoException(); + } + + void onCaptureStarted(int32_t requestId, int64_t timestamp) + { + ALOGV("onCaptureStarted"); + Parcel data, reply; + data.writeInterfaceToken(ICameraDeviceCallbacks::getInterfaceDescriptor()); + data.writeInt32(requestId); + data.writeInt64(timestamp); + remote()->transact(CAPTURE_STARTED, data, &reply, IBinder::FLAG_ONEWAY); + data.writeNoException(); + } + + void onResultReceived(int32_t requestId, const CameraMetadata& result) { ALOGV("onResultReceived"); Parcel data, reply; @@ -79,18 +99,33 @@ status_t BnCameraDeviceCallbacks::onTransact( { ALOGV("onTransact - code = %d", code); switch(code) { - case NOTIFY_CALLBACK: { - ALOGV("NOTIFY_CALLBACK"); + case CAMERA_ERROR: { + ALOGV("onDeviceError"); + CHECK_INTERFACE(ICameraDeviceCallbacks, data, reply); + CameraErrorCode errorCode = + static_cast<CameraErrorCode>(data.readInt32()); + onDeviceError(errorCode); + data.readExceptionCode(); + return NO_ERROR; + } break; + case CAMERA_IDLE: { + ALOGV("onDeviceIdle"); CHECK_INTERFACE(ICameraDeviceCallbacks, data, reply); - int32_t msgType = data.readInt32(); - int32_t ext1 = data.readInt32(); - int32_t ext2 = data.readInt32(); - notifyCallback(msgType, ext1, ext2); + onDeviceIdle(); + data.readExceptionCode(); + return NO_ERROR; + } break; + case CAPTURE_STARTED: { + ALOGV("onCaptureStarted"); + CHECK_INTERFACE(ICameraDeviceCallbacks, data, reply); + int32_t requestId = data.readInt32(); + int64_t timestamp = data.readInt64(); + onCaptureStarted(requestId, timestamp); data.readExceptionCode(); return NO_ERROR; } break; case RESULT_RECEIVED: { - ALOGV("RESULT_RECEIVED"); + ALOGV("onResultReceived"); CHECK_INTERFACE(ICameraDeviceCallbacks, data, reply); int32_t requestId = data.readInt32(); CameraMetadata result; @@ -102,8 +137,7 @@ status_t BnCameraDeviceCallbacks::onTransact( onResultReceived(requestId, result); data.readExceptionCode(); return NO_ERROR; - break; - } + } break; default: return BBinder::onTransact(code, data, reply, flags); } |