From 9c7d957b70a4daa29af48cb4c695bae64eb5bcf1 Mon Sep 17 00:00:00 2001 From: Mingming Yin Date: Thu, 4 Sep 2014 16:22:19 -0700 Subject: stagefright: Remove assert for corrupt clips for AMRNB Corrupt AMR NB clips were crashing media player This was due to the assert in the AMRNB decoder. To avoid this, post error and exit if corrupt clip is played. CRs-Fixed: 486681 Change-Id: I4c27a95978015e5493799ca23a3598559ad8bd9d --- media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'media') diff --git a/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp b/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp index a9723ea..f8316fd 100644 --- a/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp +++ b/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp @@ -352,7 +352,14 @@ void SoftAMR::onQueueFilled(OMX_U32 /* portIndex */) { } size_t frameSize = getFrameSize(mode); - CHECK_GE(inHeader->nFilledLen, frameSize); + if (inHeader->nFilledLen < frameSize) { + ALOGE("Filled length vs frameSize %u vs %lu. Corrupt clip?", + inHeader->nFilledLen, frameSize); + + notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); + mSignalledError = true; + return; + } int16_t *outPtr = (int16_t *)outHeader->pBuffer; -- cgit v1.1