diff options
author | Dave Sparks <davidsparks@android.com> | 2009-07-08 15:56:53 -0700 |
---|---|---|
committer | Dave Sparks <davidsparks@android.com> | 2009-07-08 15:59:25 -0700 |
commit | 59c1a935295cb30c2ba2f759855e89c174b42a07 (patch) | |
tree | ecb4f9b555dca38af549fa469f97e734d9fcc799 /camera/libcameraservice | |
parent | a5188a09bd20c376b4f0645b0df4c52f8e114e21 (diff) | |
download | frameworks_base-59c1a935295cb30c2ba2f759855e89c174b42a07.zip frameworks_base-59c1a935295cb30c2ba2f759855e89c174b42a07.tar.gz frameworks_base-59c1a935295cb30c2ba2f759855e89c174b42a07.tar.bz2 |
Add timestamps to video frames to improve A/V sync.
Bug 1927069.
Diffstat (limited to 'camera/libcameraservice')
-rw-r--r-- | camera/libcameraservice/CameraService.cpp | 11 | ||||
-rw-r--r-- | camera/libcameraservice/CameraService.h | 4 |
2 files changed, 7 insertions, 8 deletions
diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp index 022fe5a..e4b6791 100644 --- a/camera/libcameraservice/CameraService.cpp +++ b/camera/libcameraservice/CameraService.cpp @@ -504,8 +504,7 @@ status_t CameraService::Client::startRecordingMode() } // start recording mode - ret = mHardware->startRecording(recordingCallback, - mCameraService.get()); + ret = mHardware->startRecording(recordingCallback, mCameraService.get()); if (ret != NO_ERROR) { LOGE("mHardware->startRecording() failed with status %d", ret); } @@ -798,7 +797,7 @@ void CameraService::Client::previewCallback(const sp<IMemory>& mem, void* user) } // recording callback -void CameraService::Client::recordingCallback(const sp<IMemory>& mem, void* user) +void CameraService::Client::recordingCallback(nsecs_t timestamp, const sp<IMemory>& mem, void* user) { LOGV("recordingCallback"); sp<Client> client = getClientFromCookie(user); @@ -806,7 +805,7 @@ void CameraService::Client::recordingCallback(const sp<IMemory>& mem, void* user return; } // The strong pointer guarantees the client will exist, but no lock is held. - client->postRecordingFrame(mem); + client->postRecordingFrame(timestamp, mem); } // take a picture - image is returned in callback @@ -1072,14 +1071,14 @@ void CameraService::Client::copyFrameAndPostCopiedFrame(sp<IMemoryHeap> heap, si mCameraClient->dataCallback(CAMERA_MSG_PREVIEW_FRAME, frame); } -void CameraService::Client::postRecordingFrame(const sp<IMemory>& frame) +void CameraService::Client::postRecordingFrame(nsecs_t timestamp, const sp<IMemory>& frame) { LOGV("postRecordingFrame"); if (frame == 0) { LOGW("frame is a null pointer"); return; } - mCameraClient->dataCallback(CAMERA_MSG_VIDEO_FRAME, frame); + mCameraClient->dataCallbackTimestamp(timestamp, CAMERA_MSG_VIDEO_FRAME, frame); } void CameraService::Client::postPreviewFrame(const sp<IMemory>& mem) diff --git a/camera/libcameraservice/CameraService.h b/camera/libcameraservice/CameraService.h index 0f07673..ea93789 100644 --- a/camera/libcameraservice/CameraService.h +++ b/camera/libcameraservice/CameraService.h @@ -132,7 +132,7 @@ private: status_t checkPid(); - static void recordingCallback(const sp<IMemory>& mem, void* user); + static void recordingCallback(nsecs_t timestamp, const sp<IMemory>& mem, void* user); static void previewCallback(const sp<IMemory>& mem, void* user); static void shutterCallback(void *user); static void yuvPictureCallback(const sp<IMemory>& mem, void* user); @@ -144,7 +144,7 @@ private: void postRaw(const sp<IMemory>& mem); void postJpeg(const sp<IMemory>& mem); void postPreviewFrame(const sp<IMemory>& mem); - void postRecordingFrame(const sp<IMemory>& frame); + void postRecordingFrame(nsecs_t timestamp, const sp<IMemory>& frame); void copyFrameAndPostCopiedFrame(sp<IMemoryHeap> heap, size_t offset, size_t size); void postError(status_t error); void postAutoFocus(bool focused); |