diff options
author | Marco Nelissen <marcone@google.com> | 2013-11-15 14:25:37 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-11-15 14:25:37 -0800 |
commit | ca22dd5d69fdfa17e556839cff6c14e1287c0284 (patch) | |
tree | 2e37d5e777613baf2568f1ebc0182e4ebb2084d6 | |
parent | 731076cc7857fe322eed018569a2a67f6eac0e54 (diff) | |
parent | 2381f06f374ee0cb8bca0edf5388394432b00e6d (diff) | |
download | frameworks_av-ca22dd5d69fdfa17e556839cff6c14e1287c0284.zip frameworks_av-ca22dd5d69fdfa17e556839cff6c14e1287c0284.tar.gz frameworks_av-ca22dd5d69fdfa17e556839cff6c14e1287c0284.tar.bz2 |
am 2381f06f: am 24605338: Merge "Fix metadata access" into klp-dev
* commit '2381f06f374ee0cb8bca0edf5388394432b00e6d':
Fix metadata access
-rw-r--r-- | media/libstagefright/MPEG4Extractor.cpp | 9 | ||||
-rw-r--r-- | media/libstagefright/MetaData.cpp | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp index 8368b39..8cf5026 100644 --- a/media/libstagefright/MPEG4Extractor.cpp +++ b/media/libstagefright/MPEG4Extractor.cpp @@ -1370,9 +1370,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 @@ -1389,6 +1386,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 @@ -1402,6 +1401,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(); diff --git a/media/libstagefright/MetaData.cpp b/media/libstagefright/MetaData.cpp index ae6ae2d..7b60afc 100644 --- a/media/libstagefright/MetaData.cpp +++ b/media/libstagefright/MetaData.cpp @@ -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; |