summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/MPEG4Extractor.cpp
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2013-11-15 14:21:32 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2013-11-15 14:21:32 -0800
commit2381f06f374ee0cb8bca0edf5388394432b00e6d (patch)
tree3e9f801983c3f77bbd245ee247561cd2f84fba9e /media/libstagefright/MPEG4Extractor.cpp
parent06d6254823b8f7a46690369e57b5f149c94c9f65 (diff)
parent246053380a9f628405a29a055a3f1f4fba13ed5b (diff)
downloadframeworks_av-2381f06f374ee0cb8bca0edf5388394432b00e6d.zip
frameworks_av-2381f06f374ee0cb8bca0edf5388394432b00e6d.tar.gz
frameworks_av-2381f06f374ee0cb8bca0edf5388394432b00e6d.tar.bz2
am 24605338: Merge "Fix metadata access" into klp-dev
* commit '246053380a9f628405a29a055a3f1f4fba13ed5b': Fix metadata access
Diffstat (limited to 'media/libstagefright/MPEG4Extractor.cpp')
-rw-r--r--media/libstagefright/MPEG4Extractor.cpp9
1 files changed, 6 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();