From 83835653e47c09f1d2257d4847cd95080a0673a2 Mon Sep 17 00:00:00 2001 From: Harish Mahendrakar Date: Fri, 2 Oct 2015 16:01:36 +0530 Subject: SoftAVCDec: Exit gracefully when memory allocation fails in the decoder Change-Id: Ib6e16be3f128e4fc97f8f05b794da980341c81cc --- media/libstagefright/codecs/avcdec/SoftAVCDec.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'media/libstagefright') diff --git a/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp b/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp index 8101f75..afbe230 100644 --- a/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp +++ b/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp @@ -477,6 +477,9 @@ void SoftAVC::onQueueFilled(OMX_U32 portIndex) { if (NULL == mCodecCtx) { if (OK != initDecoder()) { + ALOGE("Failed to initialize decoder"); + notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL); + mSignalledError = true; return; } } @@ -593,6 +596,14 @@ void SoftAVC::onQueueFilled(OMX_U32 portIndex) { return; } + bool allocationFailed = (IVD_MEM_ALLOC_FAILED == (s_dec_op.u4_error_code & 0xFF)); + if (allocationFailed) { + ALOGE("Allocation failure in decoder"); + notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL); + mSignalledError = true; + return; + } + bool resChanged = (IVD_RES_CHANGED == (s_dec_op.u4_error_code & 0xFF)); GETTIME(&mTimeEnd, NULL); -- cgit v1.1