Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55badc66 authored by Chong Zhang's avatar Chong Zhang
Browse files

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 226cedd0)
parent 804b87d1
Loading
Loading
Loading
Loading
+17 −15
Original line number Diff line number Diff line
@@ -1826,6 +1826,23 @@ status_t ACodec::configureCodec(
            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 @@ status_t ACodec::configureCodec(
        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