summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/ACodec.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2013-08-13 17:13:24 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-08-13 17:13:24 +0000
commitcd06d357ed4fcde991aa55dc97317d97cb287332 (patch)
treeb6bc5dab4fa6096bcd314749878760c279033e3f /media/libstagefright/ACodec.cpp
parent1e0b080825a169c6ac655f11a798ff177575608c (diff)
parenta61285dcf1da8a2cf40c499ee3a7b9fc4d74ac58 (diff)
downloadframeworks_av-cd06d357ed4fcde991aa55dc97317d97cb287332.zip
frameworks_av-cd06d357ed4fcde991aa55dc97317d97cb287332.tar.gz
frameworks_av-cd06d357ed4fcde991aa55dc97317d97cb287332.tar.bz2
Merge "Optionally repeat the previously submitted frame to the encoder" into klp-dev
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r--media/libstagefright/ACodec.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 36549d1..7b0bce0 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -369,7 +369,8 @@ ACodec::ACodec()
mChannelMask(0),
mDequeueCounter(0),
mStoreMetaDataInOutputBuffers(false),
- mMetaDataBuffersToSubmit(0) {
+ mMetaDataBuffersToSubmit(0),
+ mRepeatFrameDelayUs(-1ll) {
mUninitializedState = new UninitializedState(this);
mLoadedState = new LoadedState(this);
mLoadedToIdleState = new LoadedToIdleState(this);
@@ -1089,6 +1090,12 @@ status_t ACodec::configureCodec(
} else {
mUseMetadataOnEncoderOutput = enable;
}
+
+ if (!msg->findInt64(
+ "repeat-previous-frame-after",
+ &mRepeatFrameDelayUs)) {
+ mRepeatFrameDelayUs = -1ll;
+ }
}
// Always try to enable dynamic output buffers on native surface
@@ -3611,6 +3618,7 @@ void ACodec::LoadedState::stateEntered() {
mCodec->mDequeueCounter = 0;
mCodec->mMetaDataBuffersToSubmit = 0;
+ mCodec->mRepeatFrameDelayUs = -1ll;
if (mCodec->mShutdownInProgress) {
bool keepComponentAllocated = mCodec->mKeepComponentAllocated;
@@ -3742,6 +3750,23 @@ void ACodec::LoadedState::onCreateInputSurface(
err = mCodec->mOMX->createInputSurface(mCodec->mNode, kPortIndexInput,
&bufferProducer);
+
+ if (err == OK && mCodec->mRepeatFrameDelayUs > 0ll) {
+ err = mCodec->mOMX->setInternalOption(
+ mCodec->mNode,
+ kPortIndexInput,
+ IOMX::INTERNAL_OPTION_REPEAT_PREVIOUS_FRAME_DELAY,
+ &mCodec->mRepeatFrameDelayUs,
+ sizeof(mCodec->mRepeatFrameDelayUs));
+
+ if (err != OK) {
+ ALOGE("[%s] Unable to configure option to repeat previous "
+ "frames (err %d)",
+ mCodec->mComponentName.c_str(),
+ err);
+ }
+ }
+
if (err == OK) {
notify->setObject("input-surface",
new BufferProducerWrapper(bufferProducer));