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

Commit 9b2aa31c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix thumbnail track skipping" into pi-dev

parents 63977aac 15033bd2
Loading
Loading
Loading
Loading
+27 −11
Original line number Diff line number Diff line
@@ -1123,12 +1123,25 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {

        case FOURCC('t', 'r', 'e', 'f'):
        {
            *offset += chunk_size;

            if (mLastTrack == NULL) {
            off64_t stop_offset = *offset + chunk_size;
            *offset = data_offset;
            while (*offset < stop_offset) {
                status_t err = parseChunk(offset, depth + 1);
                if (err != OK) {
                    return err;
                }
            }
            if (*offset != stop_offset) {
                return ERROR_MALFORMED;
            }
            break;
        }

        case FOURCC('t', 'h', 'm', 'b'):
        {
            *offset += chunk_size;

            if (mLastTrack != NULL) {
                // Skip thumbnail track for now since we don't have an
                // API to retrieve it yet.
                // The thumbnail track can't be accessed by negative index or time,
@@ -1136,6 +1149,7 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
                // in the thumbnail track. We'll need a dedicated API to retrieve
                // thumbnail at time instead.
                mLastTrack->skipTrack = true;
            }

            break;
        }
@@ -2353,9 +2367,11 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
                    // This means that the file should have moov box.
                    // It could be any iso files (mp4, heifs, etc.)
                    mHasMoovBox = true;
                    if (mIsHeif) {
                        ALOGV("identified HEIF image with other tracks");
                    }
                }
            }

            *offset = stop_offset;