Bug 1314858 - Add MP4Decoder::IsAAC. r=gerald draft
authorChris Pearce <cpearce@mozilla.com>
Wed, 02 Nov 2016 09:43:45 +1300
changeset 433498 6fe2543788afd26682d31c0ec45b9ac80e501ab1
parent 433497 2f45a346da682db71bf6b13a6be639da5d9aef71
child 433499 90e6018b6574c0d2f5a51ad56ab87ef5b535f124
push id34604
push usercpearce@mozilla.com
push dateThu, 03 Nov 2016 21:15:09 +0000
reviewersgerald
bugs1314858
milestone52.0a1
Bug 1314858 - Add MP4Decoder::IsAAC. r=gerald We have this for H.264, so we may as well have it for AAC too. MozReview-Commit-ID: 2k64ANJGUNN
dom/media/fmp4/MP4Decoder.cpp
dom/media/fmp4/MP4Decoder.h
--- a/dom/media/fmp4/MP4Decoder.cpp
+++ b/dom/media/fmp4/MP4Decoder.cpp
@@ -166,16 +166,23 @@ bool
 MP4Decoder::IsH264(const nsACString& aMimeType)
 {
   return aMimeType.EqualsLiteral("video/mp4") ||
          aMimeType.EqualsLiteral("video/avc");
 }
 
 /* static */
 bool
+MP4Decoder::IsAAC(const nsACString& aMimeType)
+{
+  return aMimeType.EqualsLiteral("audio/mp4a-latm");
+}
+
+/* static */
+bool
 MP4Decoder::IsEnabled()
 {
   return Preferences::GetBool("media.mp4.enabled", true);
 }
 
 // sTestH264ExtraData represents the content of the avcC atom found in
 // an AVC1 h264 video. It contains the H264 SPS and PPS NAL.
 // the structure of the avcC atom is as follow:
--- a/dom/media/fmp4/MP4Decoder.h
+++ b/dom/media/fmp4/MP4Decoder.h
@@ -35,16 +35,21 @@ public:
   static bool CanHandleMediaType(const MediaContentType& aType,
                                  DecoderDoctorDiagnostics* aDiagnostics);
 
   // Return true if aMimeType is a one of the strings used by our demuxers to
   // identify H264. Does not parse general content type strings, i.e. white
   // space matters.
   static bool IsH264(const nsACString& aMimeType);
 
+  // Return true if aMimeType is a one of the strings used by our demuxers to
+  // identify AAC. Does not parse general content type strings, i.e. white
+  // space matters.
+  static bool IsAAC(const nsACString& aMimeType);
+
   // Returns true if the MP4 backend is preffed on.
   static bool IsEnabled();
 
   static already_AddRefed<dom::Promise>
   IsVideoAccelerated(layers::KnowsCompositor* aKnowsCompositor, nsIGlobalObject* aParent);
 
   void GetMozDebugReaderData(nsAString& aString) override;