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

Commit e27e223d authored by Hangyu Kuang's avatar Hangyu Kuang Committed by Gerrit Code Review
Browse files

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

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


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


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


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


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


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


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

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


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


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

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



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

    bool mKeyFrameRequested;


#ifdef FILE_DUMP_ENABLE
#ifdef FILE_DUMP_ENABLE
    char mInFile[200];
    char mInFile[200];