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

Commit 3d036cbc authored by Luis GarciaCalderon's avatar Luis GarciaCalderon Committed by Ricardo Cerqueira
Browse files

libstagefright : Fix for clips with Corrupt NAL length

-Stagefright returns ERROR_MALFORMED if the NAL length is corrupt
 resulting in Cannot Play Video message.
-Ignore the frame if the NAL is corrupt.
-Return Custom error ERROR_CORRUPT_NAL and issue a new frame read.

Change-Id: I248b9920d0c3588c5e433e0822f3f663993f2858
CRs-Fixed: 256840
parent ae1a9554
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -41,6 +41,11 @@ enum {
    INFO_FORMAT_CHANGED    = MEDIA_ERROR_BASE - 12,
    INFO_DISCONTINUITY     = MEDIA_ERROR_BASE - 13,

#ifdef QCOM_HARDWARE
    //Custom Error for corrupt NAL
    ERROR_CORRUPT_NAL      = MEDIA_ERROR_BASE - 99,
#endif

    // The following constant values should be in sync with
    // drm/drm_framework_common.h
    DRM_ERROR_BASE = -2000,
+10 −0
Original line number Diff line number Diff line
@@ -2250,14 +2250,24 @@ status_t MPEG4Source::read(
                }

                if (isMalFormed) {
                    //If NAL Length is corrupt,
                    //return custom error ERROR_CORRUPT_NAL
                    LOGE("Video is malformed");
                    mBuffer->release();
                    mBuffer = NULL;

                    if (mStatistics) mNumSamplesReadError++;
#ifndef QCOM_HARDWARE
                    return ERROR_MALFORMED;
#else
                    srcOffset -= mNALLengthSize;
                    srcOffset += size;
                    ++mCurrentSampleIndex;
                    return ERROR_CORRUPT_NAL;
#endif
                }


                if (nalLength == 0) {
                    continue;
                }
+6 −0
Original line number Diff line number Diff line
@@ -3725,6 +3725,12 @@ bool OMXCodec::drainInputBuffer(BufferInfo *info) {
            err = mSource->read(&srcBuffer);
        }

#ifdef QCOM_HARDWARE
        if (err == ERROR_CORRUPT_NAL) {
            LOGW("Ignore Corrupt NAL");
            continue;
        } else 
#endif
        if (err != OK) {
            signalEOS = true;
            mFinalStatus = err;