Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83835653 authored by Harish Mahendrakar's avatar Harish Mahendrakar Committed by Marco Nelissen
Browse files

SoftAVCDec: Exit gracefully when memory allocation fails in the decoder

Change-Id: Ib6e16be3f128e4fc97f8f05b794da980341c81cc
parent b4ec8d05
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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);