From 3ecc9db40b1fb9c7f807a5892e5c9625aac1fb06 Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Tue, 16 Jun 2015 14:50:36 -0700 Subject: Fix software video decoder buffer size calculation Various software video decoders would specify the buffer size as if it were fully cropped, which then failed a sanity check in SoftwareRenderer. They now return the full buffer size. Bug: 21717327 Bug: 21443020 Change-Id: I19fcd091827ebd52a95a5509281a07ccc156e0e5 --- media/libstagefright/codecs/avcdec/SoftAVCDec.cpp | 2 +- media/libstagefright/codecs/on2/dec/SoftVPX.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'media') diff --git a/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp b/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp index 8ac337a..f3af777 100755 --- a/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp +++ b/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp @@ -787,7 +787,7 @@ void SoftAVC::onQueueFilled(OMX_U32 portIndex) { } if (s_dec_op.u4_output_present) { - outHeader->nFilledLen = (mWidth * mHeight * 3) / 2; + outHeader->nFilledLen = (outputBufferWidth() * outputBufferHeight() * 3) / 2; outHeader->nTimeStamp = mTimeStamps[s_dec_op.u4_ts]; mTimeStampsValid[s_dec_op.u4_ts] = false; diff --git a/media/libstagefright/codecs/on2/dec/SoftVPX.cpp b/media/libstagefright/codecs/on2/dec/SoftVPX.cpp index a35909e..e161fb8 100644 --- a/media/libstagefright/codecs/on2/dec/SoftVPX.cpp +++ b/media/libstagefright/codecs/on2/dec/SoftVPX.cpp @@ -146,8 +146,8 @@ bool SoftVPX::outputBuffers(bool flushDecoder, bool display, bool eos, bool *por } outHeader->nOffset = 0; - outHeader->nFilledLen = (width * height * 3) / 2; outHeader->nFlags = 0; + outHeader->nFilledLen = (outputBufferWidth() * outputBufferHeight() * 3) / 2; outHeader->nTimeStamp = *(OMX_TICKS *)mImg->user_priv; uint8_t *dst = outHeader->pBuffer; -- cgit v1.1