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

Commit d4456ec7 authored by Harish Mahendrakar's avatar Harish Mahendrakar
Browse files

SoftAVCEnc: Modified the code for runtime change in params to be generic

mBitrateUpdated and mKeyFrameRequested are removed and instead mUpdateFlag
with one bit for each param, will be used to configure the codec in runtime.
This change will make it cleaner to configure more parameters in run-time

Change-Id: I935827b54b0de469fa3c83237cccd4b5e4dcedd6
parent 94f48a75
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -157,8 +157,7 @@ SoftAVC::SoftAVC(
            kProfileLevels, NELEM(kProfileLevels),
            176 /* width */, 144 /* height */,
            callbacks, appData, component),
      mBitrateUpdated(false),
      mKeyFrameRequested(false),
      mUpdateFlag(0),
      mIvVideoColorFormat(IV_YUV_420P),
      mAVCEncProfile(IV_PROFILE_BASE),
      mAVCEncLevel(41),
@@ -1039,7 +1038,9 @@ OMX_ERRORTYPE SoftAVC::setConfig(
                return OMX_ErrorBadPortIndex;
            }

            mKeyFrameRequested = params->IntraRefreshVOP;
            if (params->IntraRefreshVOP) {
                mUpdateFlag |= kRequestKeyFrame;
            }
            return OMX_ErrorNone;
        }

@@ -1054,7 +1055,7 @@ OMX_ERRORTYPE SoftAVC::setConfig(

            if (mBitrate != params->nEncodeBitrate) {
                mBitrate = params->nEncodeBitrate;
                mBitrateUpdated = true;
                mUpdateFlag |= kUpdateBitrate;
            }
            return OMX_ErrorNone;
        }
@@ -1071,7 +1072,7 @@ OMX_ERRORTYPE SoftAVC::internalSetBitrateParams(
    }

    mBitrate = bitrate->nTargetBitrate;
    mBitrateUpdated = true;
    mUpdateFlag |= kUpdateBitrate;

    return OMX_ErrorNone;
}
@@ -1291,13 +1292,15 @@ void SoftAVC::onQueueFilled(OMX_U32 portIndex) {
            return;
        }

        if (mBitrateUpdated) {
        if (mUpdateFlag) {
            if (mUpdateFlag & kUpdateBitrate) {
                setBitRate();
            }

        if (mKeyFrameRequested) {
            if (mUpdateFlag & kRequestKeyFrame) {
                setFrameType(IV_IDR_FRAME);
            }
            mUpdateFlag = 0;
        }

        if ((inputBufferHeader != NULL)
                && (inputBufferHeader->nFlags & OMX_BUFFERFLAG_EOS)) {
+6 −5
Original line number Diff line number Diff line
@@ -142,6 +142,11 @@ private:
        kNumBuffers = 2,
    };

    enum {
      kUpdateBitrate            = 1 << 0,
      kRequestKeyFrame          = 1 << 1,
    };

    // OMX input buffer's timestamp and flags
    typedef struct {
        int64_t mTimeUs;
@@ -153,11 +158,7 @@ private:
    struct timeval mTimeStart;   // Time at the start of decode()
    struct timeval mTimeEnd;     // Time at the end of decode()


    // If a request for a change it bitrate has been received.
    bool mBitrateUpdated;

    bool mKeyFrameRequested;
    int mUpdateFlag;

#ifdef FILE_DUMP_ENABLE
    char mInFile[200];