Bug 859711 - [A/V] Add mp4 sniffer to recognizing isom/iso2 comptiable_brand. r=padenot
authorMarco Chen <mchen@mozilla.com>
Tue, 07 May 2013 10:17:34 +0800
changeset 141955 a4b5223f39b7824008ef83024acf2471dc37afab
parent 141954 89206d922d851906006f1e3a80dc9f4e84519da9
child 141956 a8593b74704a326d451544a97e6bc8af26c5575c
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs859711
milestone23.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 859711 - [A/V] Add mp4 sniffer to recognizing isom/iso2 comptiable_brand. r=padenot
toolkit/components/mediasniffer/nsMediaSniffer.cpp
--- a/toolkit/components/mediasniffer/nsMediaSniffer.cpp
+++ b/toolkit/components/mediasniffer/nsMediaSniffer.cpp
@@ -53,22 +53,29 @@ static bool MatchesMP4(const uint8_t* aD
       aData[6] != 0x79 ||
       aData[7] != 0x70) {
     return false;
   }
   for (uint32_t i = 2; i <= boxSize / 4 - 1 ; i++) {
     if (i == 3) {
       continue;
     }
-    // The string "mp4".
+    // The string "mp42" or "mp41".
     if (aData[4*i]   == 0x6D &&
         aData[4*i+1] == 0x70 &&
         aData[4*i+2] == 0x34) {
       return true;
     }
+    // The string "isom" or "iso2".
+    if (aData[4*i]   == 0x69 &&
+        aData[4*i+1] == 0x73 &&
+        aData[4*i+2] == 0x6F &&
+        (aData[4*i+3] == 0x6D || aData[4*i+3] == 0x32)) {
+      return true;
+    }
   }
   return false;
 }
 
 static bool MatchesWebM(const uint8_t* aData, const uint32_t aLength)
 {
 #ifdef MOZ_WEBM
   return nestegg_sniff((uint8_t*)aData, aLength) ? true : false;