From: Lajos Molnar Date: Wed, 24 Sep 2014 20:55:10 +0000 (-0700) Subject: stagefright: use frame height if slice height is 0 X-Git-Tag: android-x86-6.0-r1~852^2~287^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=b32ebac7e3afb49b41eeccf130c8a96c1dae85d1;p=android-x86%2Fframeworks-av.git stagefright: use frame height if slice height is 0 This is a workaround for some vendors that set slice height to 0. Android uses slice height is the vertical stride for YUV planar and semiplanar formats. Bug: 13433554 Change-Id: I4da038e7a768dcd8360c33fa1a9ce95a172f16bb --- diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 3c04859d26..4589ed1f2d 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -2933,13 +2933,6 @@ bool ACodec::describeDefaultColorFormat(DescribeColorFormatParams ¶ms) { image.mNumPlanes = 0; const OMX_COLOR_FORMATTYPE fmt = params.eColorFormat; - // we need stride and slice-height to be non-zero - if (params.nStride == 0 || params.nSliceHeight == 0) { - ALOGW("cannot describe color format 0x%x = %d with stride=%u and sliceHeight=%u", - fmt, fmt, params.nStride, params.nSliceHeight); - return false; - } - image.mWidth = params.nFrameWidth; image.mHeight = params.nFrameHeight; @@ -2952,6 +2945,20 @@ bool ACodec::describeDefaultColorFormat(DescribeColorFormatParams ¶ms) { return false; } + // TEMPORARY FIX for some vendors that advertise sliceHeight as 0 + if (params.nStride != 0 && params.nSliceHeight == 0) { + ALOGW("using sliceHeight=%u instead of what codec advertised (=0)", + params.nFrameHeight); + params.nSliceHeight = params.nFrameHeight; + } + + // we need stride and slice-height to be non-zero + if (params.nStride == 0 || params.nSliceHeight == 0) { + ALOGW("cannot describe color format 0x%x = %d with stride=%u and sliceHeight=%u", + fmt, fmt, params.nStride, params.nSliceHeight); + return false; + } + // set-up YUV format image.mType = MediaImage::MEDIA_IMAGE_TYPE_YUV; image.mNumPlanes = 3;