Bug 1045915 - Add a pref to test streams with a missing ftyp atom; r=kinetik
authorAnthony Jones <ajones@mozilla.com>
Tue, 05 Aug 2014 18:12:46 +1200
changeset 197792 9b728101e05f8ec035c63731eec31972ea0d15a2
parent 197791 4df1d10a90cc460fa1df9837bb507e5b7a31104a
child 197793 365ed105f9cee7a8d1fd2b9847bf4e8f75c8468a
push id47219
push userajones@mozilla.com
push dateTue, 05 Aug 2014 06:13:32 +0000
treeherdermozilla-inbound@365ed105f9ce [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")) {