ACodec: read max pts gap and max fps keys for image encoders
These keys are needed to disable backward frame drops for image
encoders. They should be read for both video and image types.
bug: 141169323
Change-Id: I12bea9b25a9902a50ba0e7f7d3f8aa5a497c581c
(cherry picked from commit 226cedd0ccd3c17c917c951952e278eacd26d7c8)
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 35492bd..369e13f 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -1826,6 +1826,23 @@
mRepeatFrameDelayUs = -1LL;
}
+ if (!msg->findDouble("time-lapse-fps", &mCaptureFps)) {
+ float captureRate;
+ if (msg->findAsFloat(KEY_CAPTURE_RATE, &captureRate)) {
+ mCaptureFps = captureRate;
+ } else {
+ mCaptureFps = -1.0;
+ }
+ }
+
+ if (!msg->findInt32(
+ KEY_CREATE_INPUT_SURFACE_SUSPENDED,
+ (int32_t*)&mCreateInputBuffersSuspended)) {
+ mCreateInputBuffersSuspended = false;
+ }
+ }
+
+ if (encoder && (mIsVideo || mIsImage)) {
// only allow 32-bit value, since we pass it as U32 to OMX.
if (!msg->findInt64(KEY_MAX_PTS_GAP_TO_ENCODER, &mMaxPtsGapUs)) {
mMaxPtsGapUs = 0LL;
@@ -1842,21 +1859,6 @@
if (mMaxPtsGapUs < 0LL) {
mMaxFps = -1;
}
-
- if (!msg->findDouble("time-lapse-fps", &mCaptureFps)) {
- float captureRate;
- if (msg->findAsFloat(KEY_CAPTURE_RATE, &captureRate)) {
- mCaptureFps = captureRate;
- } else {
- mCaptureFps = -1.0;
- }
- }
-
- if (!msg->findInt32(
- KEY_CREATE_INPUT_SURFACE_SUSPENDED,
- (int32_t*)&mCreateInputBuffersSuspended)) {
- mCreateInputBuffersSuspended = false;
- }
}
// NOTE: we only use native window for video decoders