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

Commit 7f7b75fb authored by Android Build Merger (Role)'s avatar Android Build Merger (Role)
Browse files

[automerger] better mpeg2 TS elementary stream Access Unit parsing am:...

[automerger] better mpeg2 TS elementary stream Access Unit parsing am: 371066d0 am: e3f5c363 am: 87ddba14 am: a1284afb am: 127bf025 am: 066a8f10 am: 5c8526df am: 7a013b32 am: a47fe84c

Change-Id: Ic855ad9d159aa86987a644e4ce343d0bbca7601d
parents a28856d4 a47fe84c
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -1486,7 +1486,9 @@ static ssize_t getNextChunkSize(
        const uint8_t *data, size_t size) {
    static const char kStartCode[] = "\x00\x00\x01";

    if (size < 3) {
    // per ISO/IEC 14496-2 6.2.1, a chunk has a 3-byte prefix + 1-byte start code
    // we need at least <prefix><start><next prefix> to successfully scan
    if (size < 3 + 1 + 3) {
        return -EAGAIN;
    }

@@ -1494,7 +1496,7 @@ static ssize_t getNextChunkSize(
        return -EAGAIN;
    }

    size_t offset = 3;
    size_t offset = 4;
    while (offset + 2 < size) {
        if (!memcmp(&data[offset], kStartCode, 3)) {
            return offset;
@@ -1545,6 +1547,9 @@ sp<ABuffer> ElementaryStreamQueue::dequeueAccessUnitMPEG4Video() {
                    state = EXPECT_VISUAL_OBJECT_START;
                } else {
                    discard = true;
                    offset += chunkSize;
                    ALOGW("b/74114680, advance to next chunk");
                    android_errorWriteLog(0x534e4554, "74114680");
                }
                break;
            }