diff options
author | James Dong <jdong@google.com> | 2011-06-09 11:11:45 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2011-06-09 11:39:36 -0700 |
commit | 639ffaca514deb9de538bc2dc6e712380db68fd3 (patch) | |
tree | e5c23e70636a27ebba7ebafdaf29d2671f0bcfdd | |
parent | 6ad97c72b9e63b4175a1df7b99448536402a7d1f (diff) | |
download | frameworks_av-639ffaca514deb9de538bc2dc6e712380db68fd3.zip frameworks_av-639ffaca514deb9de538bc2dc6e712380db68fd3.tar.gz frameworks_av-639ffaca514deb9de538bc2dc6e712380db68fd3.tar.bz2 |
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
-rw-r--r-- | media/libstagefright/codecs/on2/h264dec/SoftAVC.cpp | 18 | ||||
-rw-r--r-- | media/libstagefright/codecs/on2/h264dec/SoftAVC.h | 1 |
2 files changed, 11 insertions, 8 deletions
diff --git a/media/libstagefright/codecs/on2/h264dec/SoftAVC.cpp b/media/libstagefright/codecs/on2/h264dec/SoftAVC.cpp index 259fbc9..830d2e0 100644 --- a/media/libstagefright/codecs/on2/h264dec/SoftAVC.cpp +++ b/media/libstagefright/codecs/on2/h264dec/SoftAVC.cpp @@ -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); diff --git a/media/libstagefright/codecs/on2/h264dec/SoftAVC.h b/media/libstagefright/codecs/on2/h264dec/SoftAVC.h index a7340c0..3439efd 100644 --- a/media/libstagefright/codecs/on2/h264dec/SoftAVC.h +++ b/media/libstagefright/codecs/on2/h264dec/SoftAVC.h @@ -67,6 +67,7 @@ private: uint32_t mWidth, mHeight, mPictureSize; uint32_t mCropLeft, mCropTop; + uint32_t mCropWidth, mCropHeight; uint8_t *mFirstPicture; int32_t mFirstPictureId; |