Bug 1045915 - Add a pref to test streams with a missing ftyp atom; r=kinetik
☠☠ backed out by b1fb58e03f0d ☠ ☠
authorAnthony Jones <ajones@mozilla.com>
Tue, 05 Aug 2014 13:35:02 +1200
changeset 197769 d137dd97d95582a63daaf541e8f54aa9b083cc47
parent 197768 50127aca27dc09a5cbe5ada60bf57c7f0d7e40fc
child 197770 70e3d6723e8ebb7ddd7b64887ad16d4ddf1d1167
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerskinetik
bugs1045915
milestone34.0a1
Bug 1045915 - Add a pref to test streams with a missing ftyp atom; r=kinetik
content/media/mediasource/SourceBuffer.cpp
--- a/content/media/mediasource/SourceBuffer.cpp
+++ b/content/media/mediasource/SourceBuffer.cpp
@@ -161,18 +161,29 @@ public:
     // file is the 'ftyp' atom followed by a file type. We just check for a
     // vaguely valid 'ftyp' atom.
 
     if (aLength < 8) {
       return false;
     }
 
     uint32_t chunk_size = BigEndian::readUint32(aData);
-    return chunk_size > 8 && aData[4] == 'f' && aData[5] == 't' &&
-      aData[6] == 'y' && aData[7] == 'p';
+    if (chunk_size < 8) {
+      return false;
+    }
+
+    if (Preferences::GetBool("media.mediasource.allow_init_moov", false)) {
+      if (aData[4] == 'm' && aData[5] == 'o' && aData[6] == 'o' &&
+          aData[7] == 'v') {
+        return true;
+      }
+    }
+
+    return aData[4] == 'f' && aData[5] == 't' && aData[6] == 'y' &&
+           aData[7] == 'p';
   }
 };
 
 
 /*static*/ ContainerParser*
 ContainerParser::CreateForMIMEType(const nsACString& aType)
 {
   if (aType.LowerCaseEqualsLiteral("video/webm") || aType.LowerCaseEqualsLiteral("audio/webm")) {