summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/ACodec.cpp
diff options
context:
space:
mode:
authorRonghua Wu <ronghuawu@google.com>2015-01-26 15:47:10 -0800
committerRonghua Wu <ronghuawu@google.com>2015-02-12 22:39:44 +0000
commit37b2b389139ed638831e49708c947863eef631ef (patch)
tree0c0ea0f002452b5108dee8e3b24a9948415f3788 /media/libstagefright/ACodec.cpp
parente2cce8139fb5a205170d4e878cc9fea5493755d1 (diff)
downloadframeworks_av-37b2b389139ed638831e49708c947863eef631ef.zip
frameworks_av-37b2b389139ed638831e49708c947863eef631ef.tar.gz
frameworks_av-37b2b389139ed638831e49708c947863eef631ef.tar.bz2
stagefright: add support for limiting framerate in GraphicBufferSource
Bug: 19014096 Change-Id: I6de781e4d140a247dfd8fd8f12c3ddd7baa39ad4
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r--media/libstagefright/ACodec.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index c8806ae..7d313e0 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -419,6 +419,7 @@ ACodec::ACodec()
mMetaDataBuffersToSubmit(0),
mRepeatFrameDelayUs(-1ll),
mMaxPtsGapUs(-1ll),
+ mMaxFps(-1),
mTimePerFrameUs(-1ll),
mTimePerCaptureUs(-1ll),
mCreateInputBuffersSuspended(false),
@@ -1259,6 +1260,10 @@ status_t ACodec::configureCodec(
mMaxPtsGapUs = -1ll;
}
+ if (!msg->findFloat("max-fps-to-encoder", &mMaxFps)) {
+ mMaxFps = -1;
+ }
+
if (!msg->findInt64("time-lapse", &mTimePerCaptureUs)) {
mTimePerCaptureUs = -1ll;
}
@@ -5110,6 +5115,21 @@ void ACodec::LoadedState::onCreateInputSurface(
}
}
+ if (err == OK && mCodec->mMaxFps > 0) {
+ err = mCodec->mOMX->setInternalOption(
+ mCodec->mNode,
+ kPortIndexInput,
+ IOMX::INTERNAL_OPTION_MAX_FPS,
+ &mCodec->mMaxFps,
+ sizeof(mCodec->mMaxFps));
+
+ if (err != OK) {
+ ALOGE("[%s] Unable to configure max fps (err %d)",
+ mCodec->mComponentName.c_str(),
+ err);
+ }
+ }
+
if (err == OK && mCodec->mTimePerCaptureUs > 0ll
&& mCodec->mTimePerFrameUs > 0ll) {
int64_t timeLapse[2];