Bug 1336271 - Allow 'ftyp' after 'moov' in improperly-muxed MP4s - r?jya
MozReview-Commit-ID: BYoElOTi4mn
--- a/media/libstagefright/binding/MoofParser.cpp
+++ b/media/libstagefright/binding/MoofParser.cpp
@@ -156,21 +156,24 @@ MoofParser::ScanForMetadata(mozilla::Med
MediaByteRangeSet byteRanges;
byteRanges += MediaByteRange(0, length);
RefPtr<mp4_demuxer::BlockingStream> stream = new BlockingStream(mSource);
BoxContext context(stream, byteRanges);
for (Box box(&context, mOffset); box.IsAvailable(); box = box.Next()) {
if (box.IsType("ftyp")) {
aFtyp = box.Range();
- continue;
- }
- if (box.IsType("moov")) {
+ if (!aMoov.IsEmpty()) {
+ break;
+ }
+ } else if (box.IsType("moov")) {
aMoov = box.Range();
- break;
+ if (!aFtyp.IsEmpty()) {
+ break;
+ }
}
}
mInitRange = aFtyp.Span(aMoov);
}
bool
MoofParser::HasMetadata()
{