Bug 1044713 - Modify MP4 metadata parser to make it less sensitive to atom ordering; r=edwin

This commit is contained in:
Anthony Jones 2014-07-28 16:32:50 +12:00
parent 38bc455483
commit 47f2e5fc02

View File

@ -476,26 +476,27 @@ status_t MPEG4Extractor::readMetaData() {
} }
off64_t offset = 0; off64_t offset = 0;
status_t err; status_t err = OK;
while (true) { while (true) {
err = parseChunk(&offset, 0);
if (err == OK) {
continue;
}
uint32_t hdr[2]; uint32_t hdr[2];
if (mDataSource->readAt(offset, hdr, 8) < 8) { if (mDataSource->readAt(offset, hdr, 8) < 8) {
break; break;
} }
uint32_t chunk_type = ntohl(hdr[1]); uint32_t chunk_type = ntohl(hdr[1]);
if (chunk_type == FOURCC('s', 'i', 'd', 'x')) { if (chunk_type == FOURCC('m', 'd', 'a', 't')) {
// parse the sidx box too break;
continue; }
} else if (chunk_type == FOURCC('m', 'o', 'o', 'f')) { if (chunk_type == FOURCC('m', 'o', 'o', 'f')) {
// store the offset of the first segment // store the offset of the first segment
mMoofOffset = offset; mMoofOffset = offset;
break;
}
err = parseChunk(&offset, 0);
if (err != OK &&
chunk_type != FOURCC('s', 'i', 'd', 'x') &&
chunk_type != FOURCC('m', 'o', 'o', 'v')) {
break;
} }
break;
} }
if (mInitCheck == OK) { if (mInitCheck == OK) {