summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/MPEG4Extractor.cpp
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2013-11-15 13:49:58 -0800
committerMarco Nelissen <marcone@google.com>2013-11-15 13:49:58 -0800
commit4256c970ad90bc555eccfd585048669bb69bca1c (patch)
tree47c357f1d049b7ba2d1421ee81c9134f3ec65328 /media/libstagefright/MPEG4Extractor.cpp
parent4215e6166fca9f87a6e9e848b3dfd4ab0d25c954 (diff)
downloadframeworks_av-4256c970ad90bc555eccfd585048669bb69bca1c.zip
frameworks_av-4256c970ad90bc555eccfd585048669bb69bca1c.tar.gz
frameworks_av-4256c970ad90bc555eccfd585048669bb69bca1c.tar.bz2
Fix metadata access
Metadata string pointers become invalid after setting more metadata, so don't cache them. b/11692062 Change-Id: Iaf1afb24cf53f7fa36f49ce759355693494076e5
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();