summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/MPEG4Extractor.cpp
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2013-11-15 21:58:45 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-11-15 21:58:45 +0000
commit246053380a9f628405a29a055a3f1f4fba13ed5b (patch)
tree842bc2d43976698482d228ae01f3c48c48eac288 /media/libstagefright/MPEG4Extractor.cpp
parentd7e59228caad3867794d847f6bf163c6495e9506 (diff)
parent4256c970ad90bc555eccfd585048669bb69bca1c (diff)
downloadframeworks_av-246053380a9f628405a29a055a3f1f4fba13ed5b.zip
frameworks_av-246053380a9f628405a29a055a3f1f4fba13ed5b.tar.gz
frameworks_av-246053380a9f628405a29a055a3f1f4fba13ed5b.tar.bz2
Merge "Fix metadata access" into klp-dev
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 b8988e6..1ba1c6e 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -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();