Bug 1121342: Re-search for Moof if an initial attempt to find it failed. r=kentuckyfriedtakahe

--HG--
extra : rebase_source : 009d8048a8917d5ff1a1660b0b6cf8220743cba8
This commit is contained in:
Jean-Yves Avenard 2015-01-16 15:48:43 +11:00
parent 4aa51c0ecc
commit 1405328928

View File

@ -111,7 +111,7 @@ private:
status_t parseTrackFragmentRun(off64_t offset, off64_t size);
status_t parseSampleAuxiliaryInformationSizes(off64_t offset, off64_t size);
status_t parseSampleAuxiliaryInformationOffsets(off64_t offset, off64_t size);
void lookForMoof();
status_t lookForMoof();
status_t moveToNextFragment();
struct TrackFragmentHeaderInfo {
@ -3204,14 +3204,14 @@ size_t MPEG4Source::parseNALSize(const uint8_t *data) const {
return 0;
}
void MPEG4Source::lookForMoof() {
status_t MPEG4Source::lookForMoof() {
off64_t offset = 0;
off64_t size;
while (true) {
uint32_t hdr[2];
auto x = mDataSource->readAt(offset, hdr, 8);
if (x < 8) {
break;
return NOT_ENOUGH_DATA;
}
uint32_t chunk_size = ntohl(hdr[0]);
uint32_t chunk_type = ntohl(hdr[1]);
@ -3220,10 +3220,10 @@ void MPEG4Source::lookForMoof() {
if (chunk_type == FOURCC('m', 'o', 'o', 'f')) {
mFirstMoofOffset = mCurrentMoofOffset = offset;
parseChunk(&offset);
break;
return OK;
}
if (chunk_type == FOURCC('m', 'd', 'a', 't')) {
break;
return OK;
}
offset += chunk_size;
}
@ -3237,8 +3237,7 @@ status_t MPEG4Source::read(
CHECK(mStarted);
if (!mLookedForMoof) {
mLookedForMoof = true;
lookForMoof();
mLookedForMoof = lookForMoof() == OK;
}
if (mFirstMoofOffset > 0) {