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

Commit 24605338 authored by Marco Nelissen's avatar Marco Nelissen Committed by Android (Google) Code Review
Browse files

Merge "Fix metadata access" into klp-dev

parents d7e59228 4256c970
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1368,9 +1368,6 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
                return err;
            }

            const char *mime;
            CHECK(mLastTrack->meta->findCString(kKeyMIMEType, &mime));

            if (max_size != 0) {
                // Assume that a given buffer only contains at most 10 chunks,
                // each chunk originally prefixed with a 2 byte length will
@@ -1387,6 +1384,8 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
                    height = 1080;
                }

                const char *mime;
                CHECK(mLastTrack->meta->findCString(kKeyMIMEType, &mime));
                if (!strcmp(mime, MEDIA_MIMETYPE_VIDEO_AVC)) {
                    // AVC requires compression ratio of at least 2, and uses
                    // macroblocks
@@ -1400,6 +1399,10 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
            }
            *offset += chunk_size;

            // NOTE: setting another piece of metadata invalidates any pointers (such as the
            // mimetype) previously obtained, so don't cache them.
            const char *mime;
            CHECK(mLastTrack->meta->findCString(kKeyMIMEType, &mime));
            // Calculate average frame rate.
            if (!strncasecmp("video/", mime, 6)) {
                size_t nSamples = mLastTrack->sampleTable->countSamples();
+3 −0
Original line number Diff line number Diff line
@@ -89,6 +89,9 @@ bool MetaData::setRect(
    return setData(key, TYPE_RECT, &r, sizeof(r));
}

/**
 * Note that the returned pointer becomes invalid when additional metadata is set.
 */
bool MetaData::findCString(uint32_t key, const char **value) {
    uint32_t type;
    const void *data;