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
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
}
*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();
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;