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

Commit 185214b2 authored by Manikanta Kanamarlapudi's avatar Manikanta Kanamarlapudi Committed by Steve Kondik
Browse files

libstagefright: mpeg2ts: Ignore continuity_counter discontinuity

The continuity counter is incremented for each ts packet. Any lost
packet results in a discontinuity, and the stock parser flushes the
current frame data leading to corruption if an I-frame is lost.
Avoid flushing on discontinuity to prevent some of this corruption.

CRs-Fixed: 663391

Change-Id: I683269dcb36a1424f6d9a6e543cf9e1ead0103a7
parent 1ca9e2f9
Loading
Loading
Loading
Loading
+0 −23
Original line number Diff line number Diff line
@@ -530,29 +530,6 @@ status_t ATSParser::Stream::parse(
        return OK;
    }

    if (mExpectedContinuityCounter >= 0
            && (unsigned)mExpectedContinuityCounter != continuity_counter) {
        ALOGI("discontinuity on stream pid 0x%04x", mElementaryPID);

        mPayloadStarted = false;
        mBuffer->setRange(0, 0);
        mExpectedContinuityCounter = -1;

#if 0
        // Uncomment this if you'd rather see no corruption whatsoever on
        // screen and suspend updates until we come across another IDR frame.

        if (mStreamType == STREAMTYPE_H264) {
            ALOGI("clearing video queue");
            mQueue->clear(true /* clearFormat */);
        }
#endif

        return OK;
    }

    mExpectedContinuityCounter = (continuity_counter + 1) & 0x0f;

    if (payload_unit_start_indicator) {
        if (mPayloadStarted) {
            // Otherwise we run the danger of receiving the trailing bytes