diff options
author | James Dong <jdong@google.com> | 2011-01-26 14:49:23 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-01-26 14:49:23 -0800 |
commit | 76fd218ca290ffbb33790ae525c494d339da9d28 (patch) | |
tree | 9b2f5f8e5cf69535aa02046cc7a12c7e9b93718d /media | |
parent | 70333cca56fd766555e46395e6d9a64c8d82ff49 (diff) | |
parent | 94eda03f76175dee88cf7941fcbdb6aec43a0d5d (diff) | |
download | frameworks_av-76fd218ca290ffbb33790ae525c494d339da9d28.zip frameworks_av-76fd218ca290ffbb33790ae525c494d339da9d28.tar.gz frameworks_av-76fd218ca290ffbb33790ae525c494d339da9d28.tar.bz2 |
am 8bea1d55: am 7fb232c4: Merge "Make sure that key frame is generated for timelapse video recording if there are at least two input video frames from camera source." into honeycomb
* commit '8bea1d5585822bb62996e789f59c7629dfd9ac50':
Make sure that key frame is generated for timelapse video recording if there are at least two input video frames from camera source.
Diffstat (limited to 'media')
-rw-r--r-- | media/libmediaplayerservice/StagefrightRecorder.cpp | 8 | ||||
-rw-r--r-- | media/libstagefright/CameraSource.cpp | 2 | ||||
-rw-r--r-- | media/libstagefright/CameraSourceTimeLapse.cpp | 5 | ||||
-rw-r--r-- | media/libstagefright/OMXCodec.cpp | 18 |
4 files changed, 30 insertions, 3 deletions
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp index 65df68c..f134cba 100644 --- a/media/libmediaplayerservice/StagefrightRecorder.cpp +++ b/media/libmediaplayerservice/StagefrightRecorder.cpp @@ -1239,6 +1239,14 @@ status_t StagefrightRecorder::setupVideoEncoder( encoder_flags |= OMXCodec::kHardwareCodecsOnly; encoder_flags |= OMXCodec::kStoreMetaDataInVideoBuffers; } + + // Do not wait for all the input buffers to become available. + // This give timelapse video recording faster response in + // receiving output from video encoder component. + if (mCaptureTimeLapse) { + encoder_flags |= OMXCodec::kOnlySubmitOneInputBufferAtOneTime; + } + sp<MediaSource> encoder = OMXCodec::Create( client.interface(), enc_meta, true /* createEncoder */, cameraSource, diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp index b1c6b18..66e0657 100644 --- a/media/libstagefright/CameraSource.cpp +++ b/media/libstagefright/CameraSource.cpp @@ -147,8 +147,8 @@ CameraSource::CameraSource( mNumFramesReceived(0), mLastFrameTimestampUs(0), mStarted(false), - mFirstFrameTimeUs(0), mNumFramesEncoded(0), + mFirstFrameTimeUs(0), mNumFramesDropped(0), mNumGlitches(0), mGlitchDurationThresholdUs(200000), diff --git a/media/libstagefright/CameraSourceTimeLapse.cpp b/media/libstagefright/CameraSourceTimeLapse.cpp index b58b9d8..e6fe618 100644 --- a/media/libstagefright/CameraSourceTimeLapse.cpp +++ b/media/libstagefright/CameraSourceTimeLapse.cpp @@ -491,7 +491,10 @@ bool CameraSourceTimeLapse::skipFrameAndModifyTimeStamp(int64_t *timestampUs) { } } - if (*timestampUs < + // Workaround to bypass the first 2 input frames for skipping. + // The first 2 output frames from the encoder are: decoder specific info and + // the compressed video frame data for the first input video frame. + if (mNumFramesEncoded >= 1 && *timestampUs < (mLastTimeLapseFrameRealTimestampUs + mTimeBetweenTimeLapseFrameCaptureUs)) { // Skip all frames from last encoded frame until // sufficient time (mTimeBetweenTimeLapseFrameCaptureUs) has passed. diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index 7c6e561..2a19b25 100644 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -522,6 +522,12 @@ status_t OMXCodec::configureCodec(const sp<MetaData> &meta, uint32_t flags) { if (flags & kStoreMetaDataInVideoBuffers) { mIsMetaDataStoredInVideoBuffers = true; } + + mOnlySubmitOneBufferAtOneTime = false; + if (flags & kOnlySubmitOneInputBufferAtOneTime) { + mOnlySubmitOneBufferAtOneTime = true; + } + if (!(flags & kIgnoreCodecSpecificData)) { uint32_t type; const void *data; @@ -2610,7 +2616,17 @@ void OMXCodec::drainInputBuffers() { Vector<BufferInfo> *buffers = &mPortBuffers[kPortIndexInput]; for (size_t i = 0; i < buffers->size(); ++i) { - if (!drainInputBuffer(&buffers->editItemAt(i))) { + BufferInfo *info = &buffers->editItemAt(i); + + if (info->mStatus != OWNED_BY_US) { + continue; + } + + if (!drainInputBuffer(info)) { + break; + } + + if (mOnlySubmitOneBufferAtOneTime) { break; } } |