summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/omx
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2015-01-10 01:59:54 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-01-10 01:59:54 +0000
commite6453027baf4c79e95b31aa602b18621e3118423 (patch)
tree4ac918ed5c398c5a3e4e8a4f3ae778040cb3e06d /media/libstagefright/omx
parent51d74bb3a3abda620ed61f51a156a73bbed2b3e6 (diff)
parentd8ba6ef11cb89672ee121ec7f4ee527446aa5dbf (diff)
downloadframeworks_av-e6453027baf4c79e95b31aa602b18621e3118423.zip
frameworks_av-e6453027baf4c79e95b31aa602b18621e3118423.tar.gz
frameworks_av-e6453027baf4c79e95b31aa602b18621e3118423.tar.bz2
am d8ba6ef1: am 38a97bd7: stagefright: keep alignment restrictions for SoftVideoDecoder
* commit 'd8ba6ef11cb89672ee121ec7f4ee527446aa5dbf': stagefright: keep alignment restrictions for SoftVideoDecoder
Diffstat (limited to 'media/libstagefright/omx')
-rw-r--r--media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp35
1 files changed, 14 insertions, 21 deletions
diff --git a/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp b/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp
index 532cf2f..4ce165b 100644
--- a/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp
+++ b/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp
@@ -149,7 +149,9 @@ void SoftVideoDecoderOMXComponent::updatePortDefinitions(bool updateCrop, bool u
// when output format changes, input buffer size does not actually change
if (updateInputSize) {
- inDef->nBufferSize = max(outDef->nBufferSize / mMinCompressionRatio, mMinInputBufferSize);
+ inDef->nBufferSize = max(
+ outDef->nBufferSize / mMinCompressionRatio,
+ max(mMinInputBufferSize, inDef->nBufferSize));
}
if (updateCrop) {
@@ -388,30 +390,21 @@ OMX_ERRORTYPE SoftVideoDecoderOMXComponent::internalSetParameter(
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;
if (outputPort) {
- def->format.video.nStride = def->format.video.nFrameWidth;
- def->format.video.nSliceHeight = def->format.video.nFrameHeight;
- def->nBufferSize =
- def->format.video.nStride * def->format.video.nSliceHeight * 3 / 2;
-
-
- OMX_PARAM_PORTDEFINITIONTYPE *inDef = &editPortInfo(kInputPortIndex)->mDef;
- // increase input buffer size if required
- inDef->nBufferSize =
- max(def->nBufferSize / mMinCompressionRatio, inDef->nBufferSize);
-
+ // only update (essentially crop) if size changes
mWidth = newWidth;
mHeight = newHeight;
- mCropLeft = 0;
- mCropTop = 0;
- mCropWidth = newWidth;
- mCropHeight = newHeight;
+
+ updatePortDefinitions(true /* updateCrop */, true /* updateInputSize */);
+ // reset buffer size based on frame size
+ newParams->nBufferSize = def->nBufferSize;
+ } else {
+ // For input port, we only set nFrameWidth and nFrameHeight. Buffer size
+ // is updated when configuring the output port using the max-frame-size,
+ // though client can still request a larger size.
+ def->format.video.nFrameWidth = newWidth;
+ def->format.video.nFrameHeight = newHeight;
}
- newParams->nBufferSize = def->nBufferSize;
}
return SimpleSoftOMXComponent::internalSetParameter(index, params);
}