summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp
diff options
context:
space:
mode:
authorRonghua Wu <ronghuawu@google.com>2014-09-22 13:26:13 -0700
committerRonghua Wu <ronghuawu@google.com>2014-09-24 15:03:22 -0700
commit42a9fd4f382253a2fb7fe6761273841c999606af (patch)
tree021b729d904f63744de09b4d23c249d5aff346af /media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp
parent80ec934ae7d4e3a78af87554fdb77a58f6386ba0 (diff)
downloadframeworks_av-42a9fd4f382253a2fb7fe6761273841c999606af.zip
frameworks_av-42a9fd4f382253a2fb7fe6761273841c999606af.tar.gz
frameworks_av-42a9fd4f382253a2fb7fe6761273841c999606af.tar.bz2
SoftVideoDecoderOMXComponent: re-config the buffer size when port definition changed.
Bug: 17326758 Change-Id: I7c6b85284ae0cbfa54f999851f56db84345b65bf
Diffstat (limited to 'media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp')
-rw-r--r--media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp b/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp
index 5853469..b5d19bc 100644
--- a/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp
+++ b/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp
@@ -343,6 +343,40 @@ OMX_ERRORTYPE SoftVideoDecoderOMXComponent::internalSetParameter(
return OMX_ErrorNone;
}
+ case OMX_IndexParamPortDefinition:
+ {
+ OMX_PARAM_PORTDEFINITIONTYPE *newParams =
+ (OMX_PARAM_PORTDEFINITIONTYPE *)params;
+ OMX_VIDEO_PORTDEFINITIONTYPE *video_def = &newParams->format.video;
+ OMX_PARAM_PORTDEFINITIONTYPE *def = &editPortInfo(newParams->nPortIndex)->mDef;
+
+ uint32_t oldWidth = def->format.video.nFrameWidth;
+ uint32_t oldHeight = def->format.video.nFrameHeight;
+ uint32_t newWidth = video_def->nFrameWidth;
+ uint32_t newHeight = video_def->nFrameHeight;
+ if (newWidth != oldWidth || newHeight != oldHeight) {
+ bool outputPort = (newParams->nPortIndex == kOutputPortIndex);
+ def->format.video.nFrameWidth =
+ (mIsAdaptive && outputPort) ? mAdaptiveMaxWidth : newWidth;
+ def->format.video.nFrameHeight =
+ (mIsAdaptive && outputPort) ? mAdaptiveMaxHeight : newHeight;
+ def->format.video.nStride = def->format.video.nFrameWidth;
+ def->format.video.nSliceHeight = def->format.video.nFrameHeight;
+ def->nBufferSize =
+ def->format.video.nFrameWidth * def->format.video.nFrameHeight * 3 / 2;
+ if (outputPort) {
+ mWidth = newWidth;
+ mHeight = newHeight;
+ mCropLeft = 0;
+ mCropTop = 0;
+ mCropWidth = newWidth;
+ mCropHeight = newHeight;
+ }
+ newParams->nBufferSize = def->nBufferSize;
+ }
+ return SimpleSoftOMXComponent::internalSetParameter(index, params);
+ }
+
default:
return SimpleSoftOMXComponent::internalSetParameter(index, params);
}