Bug 1322587: [MSE] P2. Allow additional top-level boxes. r?gerald
MozReview-Commit-ID: AE6EaPnOiJu
--- a/dom/media/mediasource/ContainerParser.cpp
+++ b/dom/media/mediasource/ContainerParser.cpp
@@ -347,17 +347,17 @@ public:
ContainerParser::IsInitSegmentPresent(aData);
// Each MP4 atom has a chunk size and chunk type. The root chunk in an MP4
// file is the 'ftyp' atom followed by a file type. We just check for a
// vaguely valid 'ftyp' atom.
AtomParser parser(mType, aData);
if (!parser.IsValid()) {
return MediaResult(
NS_ERROR_FAILURE,
- RESULT_DETAIL("Invalid Box:%s", parser.LastInvalidBox()));
+ RESULT_DETAIL("Invalid Top-Level Box:%s", parser.LastInvalidBox()));
}
return parser.StartWithInitSegment() ? NS_OK : NS_ERROR_NOT_AVAILABLE;
}
MediaResult IsMediaSegmentPresent(MediaByteBuffer* aData) override
{
AtomParser parser(mType, aData);
if (!parser.IsValid()) {
@@ -380,16 +380,18 @@ private:
// Valid top-level boxes defined in ISO/IEC 14496-12 (Table 1)
static const mp4_demuxer::AtomType validBoxes[] = {
"ftyp", "moov", // init segment
"pdin", "free", "sidx", // optional prior moov box
"styp", "moof", "mdat", // media segment
"mfra", "skip", "meta", "meco", "ssix", "prft" // others.
"pssh", // optional with encrypted EME, though ignored.
+ "emsg", // ISO23009-1:2014 Section 5.10.3.3
+ "bloc", "uuid" // boxes accepted by chrome.
};
while (reader.Remaining() >= 8) {
uint64_t size = reader.ReadU32();
const uint8_t* typec = reader.Peek(4);
mp4_demuxer::AtomType type(reader.ReadU32());
MSE_DEBUGV(AtomParser ,"Checking atom:'%c%c%c%c' @ %u",
typec[0], typec[1], typec[2], typec[3],