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

Commit 7d1d572c authored by Harish Mahendrakar's avatar Harish Mahendrakar Committed by Ray Essick
Browse files

C2SoftHevcDec: return error for fatal errors in decoder

Bug: 130578045
Test: adb shell stagefright -s -S /sdcard/crowd422_hevc.mp4
Test: Ensure decoder doesn't attemp decoding all frames
Test: atest android.media.cts.DecoderTest
Test: android.media.cts.AdaptivePlaybackTest

Change-Id: I801ad18ef5ea29d1f5dc4721ff154111023bcb68
parent 983e8ca3
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -806,19 +806,20 @@ void C2SoftHevcDec::process(
        TIME_DIFF(mTimeStart, mTimeEnd, decodeTime);
        ALOGV("decodeTime=%6d delay=%6d numBytes=%6d", decodeTime, delay,
              s_decode_op.u4_num_bytes_consumed);
        if (IVD_MEM_ALLOC_FAILED == (s_decode_op.u4_error_code & 0xFF)) {
        if (IVD_MEM_ALLOC_FAILED == (s_decode_op.u4_error_code & IVD_ERROR_MASK)) {
            ALOGE("allocation failure in decoder");
            mSignalledError = true;
            work->workletsProcessed = 1u;
            work->result = C2_CORRUPTED;
            return;
        } else if (IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED == (s_decode_op.u4_error_code & 0xFF)) {
        } else if (IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED ==
                   (s_decode_op.u4_error_code & IVD_ERROR_MASK)) {
            ALOGE("unsupported resolution : %dx%d", mWidth, mHeight);
            mSignalledError = true;
            work->workletsProcessed = 1u;
            work->result = C2_CORRUPTED;
            return;
        } else if (IVD_RES_CHANGED == (s_decode_op.u4_error_code & 0xFF)) {
        } else if (IVD_RES_CHANGED == (s_decode_op.u4_error_code & IVD_ERROR_MASK)) {
            ALOGV("resolution changed");
            drainInternal(DRAIN_COMPONENT_NO_EOS, pool, work);
            resetDecoder();
@@ -828,6 +829,12 @@ void C2SoftHevcDec::process(
            /* Decode header and get new dimensions */
            setParams(mStride, IVD_DECODE_HEADER);
            (void) ivdec_api_function(mDecHandle, &s_decode_ip, &s_decode_op);
        } else if (IS_IVD_FATAL_ERROR(s_decode_op.u4_error_code)) {
            ALOGE("Fatal error in decoder 0x%x", s_decode_op.u4_error_code);
            mSignalledError = true;
            work->workletsProcessed = 1u;
            work->result = C2_CORRUPTED;
            return;
        }
        if (0 < s_decode_op.u4_pic_wd && 0 < s_decode_op.u4_pic_ht) {
            if (mHeaderDecoded == false) {