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
--- 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;