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 id47209
push userajones@mozilla.com
push dateTue, 05 Aug 2014 01:35:18 +0000
treeherdermozilla-inbound@70e3d6723e8e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1045915
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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")) {