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

Commit 639ffaca authored by James Dong's avatar James Dong
Browse files

Correctly handle crop rect event in SoftAVC.cpp

Width and height of the video frame was incorrectly overwritten when a cropping need was detected. Using a separate
crop width and crop height resolves the problem.

Change-Id: I8a371c7fe7f8417a7995d7a7fe231120274ea0c8
related-to-bug: 4575591
parent 6ad97c72
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@ SoftAVC::SoftAVC(
      mPictureSize(mWidth * mHeight * 3 / 2),
      mCropLeft(0),
      mCropTop(0),
      mCropWidth(mWidth),
      mCropHeight(mHeight),
      mFirstPicture(NULL),
      mFirstPictureId(-1),
      mPicId(0),
@@ -230,8 +232,8 @@ OMX_ERRORTYPE SoftAVC::getConfig(

            rectParams->nLeft = mCropLeft;
            rectParams->nTop = mCropTop;
            rectParams->nWidth = mWidth;
            rectParams->nHeight = mHeight;
            rectParams->nWidth = mCropWidth;
            rectParams->nHeight = mCropHeight;

            return OMX_ErrorNone;
        }
@@ -367,6 +369,8 @@ bool SoftAVC::handlePortSettingChangeEvent(const H264SwDecInfo *info) {
        mWidth  = info->picWidth;
        mHeight = info->picHeight;
        mPictureSize = mWidth * mHeight * 3 / 2;
        mCropWidth = mWidth;
        mCropHeight = mHeight;
        updatePortDefinitions();
        notify(OMX_EventPortSettingsChanged, 1, 0, NULL);
        mOutputPortSettingsChange = AWAITING_DISABLED;
@@ -379,14 +383,12 @@ bool SoftAVC::handlePortSettingChangeEvent(const H264SwDecInfo *info) {
bool SoftAVC::handleCropRectEvent(const CropParams *crop) {
    if (mCropLeft != crop->cropLeftOffset ||
        mCropTop != crop->cropTopOffset ||
        mWidth != crop->cropOutWidth ||
        mHeight != crop->cropOutHeight) {

        mCropWidth != crop->cropOutWidth ||
        mCropHeight != crop->cropOutHeight) {
        mCropLeft = crop->cropLeftOffset;
        mCropTop = crop->cropTopOffset;
        mWidth = crop->cropOutWidth;
        mHeight = crop->cropOutHeight;
        mPictureSize = mWidth * mHeight * 3 / 2;
        mCropWidth = crop->cropOutWidth;
        mCropHeight = crop->cropOutHeight;

        notify(OMX_EventPortSettingsChanged, 1,
                OMX_IndexConfigCommonOutputCrop, NULL);
+1 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ private:

    uint32_t mWidth, mHeight, mPictureSize;
    uint32_t mCropLeft, mCropTop;
    uint32_t mCropWidth, mCropHeight;

    uint8_t *mFirstPicture;
    int32_t mFirstPictureId;