diff options
author | James Dong <jdong@google.com> | 2010-04-21 16:14:15 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2010-05-05 11:34:43 -0700 |
commit | 3300e9667e3daa374659b4a8b97dd92c4d34e501 (patch) | |
tree | 7fb447a7a23b8a992d929a5c30ca3a01cacefe18 /media/libstagefright/CameraSource.cpp | |
parent | 51867f231355b82fd0a8804352403fec102cb0dc (diff) | |
download | frameworks_base-3300e9667e3daa374659b4a8b97dd92c4d34e501.zip frameworks_base-3300e9667e3daa374659b4a8b97dd92c4d34e501.tar.gz frameworks_base-3300e9667e3daa374659b4a8b97dd92c4d34e501.tar.bz2 |
Support audio and video track interleaving in the recorded mp4 file
Change-Id: Ifa27eb23ee265f84fe06773b29b0eb2b0b075b60
Diffstat (limited to 'media/libstagefright/CameraSource.cpp')
-rw-r--r-- | media/libstagefright/CameraSource.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp index b07bd0e..b046a9c 100644 --- a/media/libstagefright/CameraSource.cpp +++ b/media/libstagefright/CameraSource.cpp @@ -130,8 +130,9 @@ CameraSource::CameraSource(const sp<Camera> &camera) mHeight(0), mFirstFrameTimeUs(0), mLastFrameTimestampUs(0), - mNumFrames(0), - mNumFramesReleased(0), + mNumFramesReceived(0), + mNumFramesEncoded(0), + mNumFramesDropped(0), mStarted(false) { String8 s = mCamera->getParameters(); printf("params: \"%s\"\n", s.string()); @@ -178,9 +179,11 @@ status_t CameraSource::stop() { mCamera->stopRecording(); releaseQueuedFrames(); - LOGI("Frames received/released: %d/%d, timestamp (us) last/first: %lld/%lld", - mNumFrames, mNumFramesReleased, + LOGI("Frames received/encoded/dropped: %d/%d/%d, timestamp (us) last/first: %lld/%lld", + mNumFramesReceived, mNumFramesEncoded, mNumFramesDropped, mLastFrameTimestampUs, mFirstFrameTimeUs); + + CHECK_EQ(mNumFramesReceived, mNumFramesEncoded + mNumFramesDropped); return OK; } @@ -190,7 +193,7 @@ void CameraSource::releaseQueuedFrames() { it = mFrames.begin(); mCamera->releaseRecordingFrame(*it); mFrames.erase(it); - ++mNumFramesReleased; + ++mNumFramesDropped; } } @@ -231,7 +234,7 @@ status_t CameraSource::read( frameTime = *mFrameTimes.begin(); mFrameTimes.erase(mFrameTimes.begin()); - ++mNumFramesReleased; + ++mNumFramesEncoded; } *buffer = new MediaBuffer(frame->size()); @@ -252,15 +255,15 @@ void CameraSource::dataCallbackTimestamp(int64_t timestampUs, Mutex::Autolock autoLock(mLock); if (!mStarted) { mCamera->releaseRecordingFrame(data); - ++mNumFrames; - ++mNumFramesReleased; + ++mNumFramesReceived; + ++mNumFramesDropped; return; } - if (mNumFrames == 0) { + if (mNumFramesReceived == 0) { mFirstFrameTimeUs = timestampUs; } - ++mNumFrames; + ++mNumFramesReceived; mFrames.push_back(data); mFrameTimes.push_back(timestampUs - mFirstFrameTimeUs); |