diff options
author | Harish Mahendrakar <harish.mahendrakar@ittiam.com> | 2018-05-29 14:29:02 -0700 |
---|---|---|
committer | Ray Essick <essick@google.com> | 2018-06-05 10:30:50 -0700 |
commit | a5c0d8b4a9f0b7be61d16875c7e9d327d9fb97da (patch) | |
tree | 5347a286e836a1e1c8816e61560f95b9888a2b1a | |
parent | b55d4e2e8655f166b123cc4b9c7f6fa43ee40765 (diff) | |
download | av-a5c0d8b4a9f0b7be61d16875c7e9d327d9fb97da.tar.gz |
SoftXAAC: Removed redundant null checks for inHeader
inHeader is always guaranteed to be non Null as it reads from
inQueue which is non empty
Bug: 80428530
Test: CTS android.media.cts.DecoderTest{AacDrc,XheAac}
Change-Id: I5bb7d119c211025c88c7f685cb6e46555467cfb8
-rw-r--r-- | media/libstagefright/codecs/xaacdec/SoftXAAC.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/media/libstagefright/codecs/xaacdec/SoftXAAC.cpp b/media/libstagefright/codecs/xaacdec/SoftXAAC.cpp index 2dd7d6963d..059c5a8970 100644 --- a/media/libstagefright/codecs/xaacdec/SoftXAAC.cpp +++ b/media/libstagefright/codecs/xaacdec/SoftXAAC.cpp @@ -601,6 +601,7 @@ void SoftXAAC::onQueueFilled(OMX_U32 /* portIndex */) { BufferInfo *inInfo = *inQueue.begin(); OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader; + /* No need to check inHeader != NULL, as inQueue is not empty */ mEndOfInput = (inHeader->nFlags & OMX_BUFFERFLAG_EOS) != 0; if (mInputBufferCount == 0 && !(inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG)) { @@ -608,9 +609,6 @@ void SoftXAAC::onQueueFilled(OMX_U32 /* portIndex */) { inHeader->nFlags |= OMX_BUFFERFLAG_CODECCONFIG; } if ((inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG) != 0) { - BufferInfo *inInfo = *inQueue.begin(); - OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader; - inBuffer = inHeader->pBuffer + inHeader->nOffset; inBufferLength = inHeader->nFilledLen; @@ -787,16 +785,12 @@ void SoftXAAC::onQueueFilled(OMX_U32 /* portIndex */) { /* Clear buffer for output buffer is done inside XAAC codec */ /* TODO - Check if below memset is on top of reset inside codec */ memset(mOutputBuffer, 0, numOutBytes); // TODO: check for overflow, ASAN - // Discard input buffer. - if (inHeader) { - inHeader->nFilledLen = 0; - } - + inHeader->nFilledLen = 0; // fall through } - if (inHeader && inHeader->nFilledLen == 0) { + if (inHeader->nFilledLen == 0) { inInfo->mOwnedByUs = false; mInputBufferCount++; inQueue.erase(inQueue.begin()); @@ -805,7 +799,7 @@ void SoftXAAC::onQueueFilled(OMX_U32 /* portIndex */) { notifyEmptyBufferDone(inHeader); inHeader = NULL; } else { - ALOGV("inHeader->nFilledLen = %d", inHeader ? inHeader->nFilledLen : 0); + ALOGV("inHeader->nFilledLen = %d", inHeader->nFilledLen); } if (!outQueue.empty() && numOutBytes) { |