Bug 1322587: [MSE] P2. Allow additional top-level boxes. r?gerald draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 09 Dec 2016 09:21:21 -1000
changeset 448281 5d18a41a5e3e80f6dc91baae87cca310d58db9ee
parent 448280 bf923d60061ab6606730abf688f69139790436d8
child 539249 d71dc3b8ba57aa5511856a4af72c725b58c1184c
push id38299
push userbmo:jyavenard@mozilla.com
push dateFri, 09 Dec 2016 19:25:36 +0000
reviewersgerald
bugs1322587
milestone53.0a1
Bug 1322587: [MSE] P2. Allow additional top-level boxes. r?gerald MozReview-Commit-ID: AE6EaPnOiJu
dom/media/mediasource/ContainerParser.cpp
--- 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],