Loading media/libstagefright/codecs/avcenc/SoftAVCEnc.cpp +14 −11 Original line number Original line Diff line number Diff line Loading @@ -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), Loading Loading @@ -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; } } Loading @@ -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; } } Loading @@ -1071,7 +1072,7 @@ OMX_ERRORTYPE SoftAVC::internalSetBitrateParams( } } mBitrate = bitrate->nTargetBitrate; mBitrate = bitrate->nTargetBitrate; mBitrateUpdated = true; mUpdateFlag |= kUpdateBitrate; return OMX_ErrorNone; return OMX_ErrorNone; } } Loading Loading @@ -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)) { Loading media/libstagefright/codecs/avcenc/SoftAVCEnc.h +6 −5 Original line number Original line Diff line number Diff line Loading @@ -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; Loading @@ -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]; Loading Loading
media/libstagefright/codecs/avcenc/SoftAVCEnc.cpp +14 −11 Original line number Original line Diff line number Diff line Loading @@ -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), Loading Loading @@ -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; } } Loading @@ -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; } } Loading @@ -1071,7 +1072,7 @@ OMX_ERRORTYPE SoftAVC::internalSetBitrateParams( } } mBitrate = bitrate->nTargetBitrate; mBitrate = bitrate->nTargetBitrate; mBitrateUpdated = true; mUpdateFlag |= kUpdateBitrate; return OMX_ErrorNone; return OMX_ErrorNone; } } Loading Loading @@ -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)) { Loading
media/libstagefright/codecs/avcenc/SoftAVCEnc.h +6 −5 Original line number Original line Diff line number Diff line Loading @@ -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; Loading @@ -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]; Loading