Backed out 13 changesets (bug 1329568) for wpt-11 failures in mediasource-addsourcebuffer.html a=backout CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Thu, 12 Jan 2017 15:10:52 -0800
changeset 329195 4caa61eee820232d92d427a6077e56bb6eee21b8
parent 329194 251ca9a04afc2bcd4e64bdea584eaf179e6a4aba
child 329196 b3b5aae6e351c0b356540df7c17f743f5b88b56e
push id31200
push usercbook@mozilla.com
push dateFri, 13 Jan 2017 09:18:41 +0000
treeherdermozilla-central@eca7348f32d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1329568
milestone53.0a1
backs out8f37ee96bd78e5672e664ebfb156650137a4f63b
706da9f85272fdd7f9db7dca77886c7d337b2819
c316c8d24d32836a198286faa93e5a5c8990d0e6
90a091e65db3ed3876bc8c51174cffb6a7f21bcd
da855d6a78bba7762df16d5e70383bd50ab80ee7
3a49367220e3921e72da2c5d72f6b3af6ec6a958
453851b40e3e8982598a179e3a598531571b935e
662529436cc4dad8be244c0bfe08c0371bbc189e
7c62078beb88dce045784041fe78b1265c1545dc
99758b5f7918a50d35bdecbe339371072df325ad
2ce9dcf0c27412fbb5cff17f9f6e13fe36d4bdda
644f206d06d6d2c01bac8c87a6e275817a3651b3
e1ed12f057c8052cf04c90fb2640bd31868807ff
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
Backed out 13 changesets (bug 1329568) for wpt-11 failures in mediasource-addsourcebuffer.html a=backout CLOSED TREE Backed out changeset 8f37ee96bd78 (bug 1329568) Backed out changeset 706da9f85272 (bug 1329568) Backed out changeset c316c8d24d32 (bug 1329568) Backed out changeset 90a091e65db3 (bug 1329568) Backed out changeset da855d6a78bb (bug 1329568) Backed out changeset 3a49367220e3 (bug 1329568) Backed out changeset 453851b40e3e (bug 1329568) Backed out changeset 662529436cc4 (bug 1329568) Backed out changeset 7c62078beb88 (bug 1329568) Backed out changeset 99758b5f7918 (bug 1329568) Backed out changeset 2ce9dcf0c274 (bug 1329568) Backed out changeset 644f206d06d6 (bug 1329568) Backed out changeset e1ed12f057c8 (bug 1329568) MozReview-Commit-ID: FhJlySehxHi
dom/media/DecoderTraits.cpp
dom/media/MediaContentType.cpp
dom/media/MediaContentType.h
dom/media/MediaMIMETypes.cpp
dom/media/MediaMIMETypes.h
dom/media/MediaStreamListener.h
dom/media/VideoUtils.cpp
dom/media/VideoUtils.h
dom/media/fmp4/MP4Decoder.cpp
dom/media/gtest/TestMediaMIMETypes.cpp
dom/media/gtest/TestVideoUtils.cpp
dom/media/gtest/moz.build
dom/media/mediasource/MediaSource.cpp
dom/media/moz.build
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -192,94 +192,83 @@ IsFlacSupportedType(const nsACString& aT
 }
 
 static
 CanPlayStatus
 CanHandleCodecsType(const MediaContentType& aType,
                     DecoderDoctorDiagnostics* aDiagnostics)
 {
   // We should have been given a codecs string, though it may be empty.
-  MOZ_ASSERT(aType.ExtendedType().HaveCodecs());
-
-  // Content type with the the MIME type, no codecs.
-  const MediaContentType mimeType(aType.Type());
+  MOZ_ASSERT(aType.HaveCodecs());
 
   char const* const* codecList = nullptr;
-  if (IsOggTypeAndEnabled(mimeType.Type().AsString())) {
-    if (IsOggSupportedType(aType.Type().AsString(),
-                           aType.ExtendedType().Codecs().AsString())) {
+  if (IsOggTypeAndEnabled(aType.GetMIMEType())) {
+    if (IsOggSupportedType(aType.GetMIMEType(), aType.GetCodecs())) {
       return CANPLAY_YES;
     } else {
       // We can only reach this position if a particular codec was requested,
       // ogg is supported and working: the codec must be invalid.
       return CANPLAY_NO;
     }
   }
-  if (IsWaveSupportedType(mimeType.Type().AsString())) {
-    if (IsWaveSupportedType(aType.Type().AsString(),
-                            aType.ExtendedType().Codecs().AsString())) {
+  if (IsWaveSupportedType(aType.GetMIMEType())) {
+    if (IsWaveSupportedType(aType.GetMIMEType(), aType.GetCodecs())) {
       return CANPLAY_YES;
     } else {
       // We can only reach this position if a particular codec was requested,
       // ogg is supported and working: the codec must be invalid.
       return CANPLAY_NO;
     }
   }
 #if !defined(MOZ_OMX_WEBM_DECODER)
-  if (DecoderTraits::IsWebMTypeAndEnabled(mimeType.Type().AsString())) {
-    if (IsWebMSupportedType(aType.Type().AsString(),
-                            aType.ExtendedType().Codecs().AsString())) {
+  if (DecoderTraits::IsWebMTypeAndEnabled(aType.GetMIMEType())) {
+    if (IsWebMSupportedType(aType.GetMIMEType(), aType.GetCodecs())) {
       return CANPLAY_YES;
     } else {
       // We can only reach this position if a particular codec was requested,
       // webm is supported and working: the codec must be invalid.
       return CANPLAY_NO;
     }
   }
 #endif
 #ifdef MOZ_FMP4
-  if (DecoderTraits::IsMP4TypeAndEnabled(mimeType.Type().AsString(), aDiagnostics)) {
+  if (DecoderTraits::IsMP4TypeAndEnabled(aType.GetMIMEType(), aDiagnostics)) {
     if (IsMP4SupportedType(aType, aDiagnostics)) {
       return CANPLAY_YES;
     } else {
       // We can only reach this position if a particular codec was requested,
       // fmp4 is supported and working: the codec must be invalid.
       return CANPLAY_NO;
     }
   }
 #endif
-  if (IsMP3SupportedType(mimeType.Type().AsString(),
-                         aType.ExtendedType().Codecs().AsString())) {
+  if (IsMP3SupportedType(aType.GetMIMEType(), aType.GetCodecs())) {
     return CANPLAY_YES;
   }
-  if (IsAACSupportedType(mimeType.Type().AsString(),
-                         aType.ExtendedType().Codecs().AsString())) {
+  if (IsAACSupportedType(aType.GetMIMEType(), aType.GetCodecs())) {
     return CANPLAY_YES;
   }
-  if (IsFlacSupportedType(mimeType.Type().AsString(),
-                          aType.ExtendedType().Codecs().AsString())) {
+  if (IsFlacSupportedType(aType.GetMIMEType(), aType.GetCodecs())) {
     return CANPLAY_YES;
   }
 #ifdef MOZ_DIRECTSHOW
-  DirectShowDecoder::GetSupportedCodecs(aType.Type().AsString(), &codecList);
+  DirectShowDecoder::GetSupportedCodecs(aType.GetMIMEType(), &codecList);
 #endif
 #ifdef MOZ_ANDROID_OMX
   if (MediaDecoder::IsAndroidMediaPluginEnabled()) {
-    EnsureAndroidMediaPluginHost()->FindDecoder(aType.Type().AsString(),
-                                                &codecList);
+    EnsureAndroidMediaPluginHost()->FindDecoder(aType.GetMIMEType(), &codecList);
   }
 #endif
   if (!codecList) {
     return CANPLAY_MAYBE;
   }
 
   // See http://www.rfc-editor.org/rfc/rfc4281.txt for the description
   // of the 'codecs' parameter
-  nsCharSeparatedTokenizer
-    tokenizer(aType.ExtendedType().Codecs().AsString(), ',');
+  nsCharSeparatedTokenizer tokenizer(aType.GetCodecs(), ',');
   bool expectMoreTokens = false;
   while (tokenizer.hasMoreTokens()) {
     const nsSubstring& token = tokenizer.nextToken();
 
     if (!CodecListContains(codecList, token)) {
       // Totally unsupported codec
       return CANPLAY_NO;
     }
@@ -295,61 +284,57 @@ CanHandleCodecsType(const MediaContentTy
 
 static
 CanPlayStatus
 CanHandleMediaType(const MediaContentType& aType,
                    DecoderDoctorDiagnostics* aDiagnostics)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  if (IsHttpLiveStreamingType(aType.Type().AsString())) {
+  if (IsHttpLiveStreamingType(aType.GetMIMEType())) {
     Telemetry::Accumulate(Telemetry::MEDIA_HLS_CANPLAY_REQUESTED, true);
   }
 
-  if (aType.ExtendedType().HaveCodecs()) {
+  if (aType.HaveCodecs()) {
     CanPlayStatus result = CanHandleCodecsType(aType, aDiagnostics);
     if (result == CANPLAY_NO || result == CANPLAY_YES) {
       return result;
     }
   }
-
-  // Content type with just the MIME type/subtype, no codecs.
-  const MediaContentType mimeType(aType.Type());
-
-  if (IsOggTypeAndEnabled(mimeType.Type().AsString())) {
+  if (IsOggTypeAndEnabled(aType.GetMIMEType())) {
     return CANPLAY_MAYBE;
   }
-  if (IsWaveSupportedType(mimeType.Type().AsString())) {
+  if (IsWaveSupportedType(aType.GetMIMEType())) {
     return CANPLAY_MAYBE;
   }
-  if (DecoderTraits::IsMP4TypeAndEnabled(mimeType.Type().AsString(), aDiagnostics)) {
+  if (DecoderTraits::IsMP4TypeAndEnabled(aType.GetMIMEType(), aDiagnostics)) {
     return CANPLAY_MAYBE;
   }
 #if !defined(MOZ_OMX_WEBM_DECODER)
-  if (DecoderTraits::IsWebMTypeAndEnabled(mimeType.Type().AsString())) {
+  if (DecoderTraits::IsWebMTypeAndEnabled(aType.GetMIMEType())) {
     return CANPLAY_MAYBE;
   }
 #endif
-  if (IsMP3SupportedType(mimeType.Type().AsString())) {
+  if (IsMP3SupportedType(aType.GetMIMEType())) {
     return CANPLAY_MAYBE;
   }
-  if (IsAACSupportedType(mimeType.Type().AsString())) {
+  if (IsAACSupportedType(aType.GetMIMEType())) {
     return CANPLAY_MAYBE;
   }
-  if (IsFlacSupportedType(mimeType.Type().AsString())) {
+  if (IsFlacSupportedType(aType.GetMIMEType())) {
     return CANPLAY_MAYBE;
   }
 #ifdef MOZ_DIRECTSHOW
-  if (DirectShowDecoder::GetSupportedCodecs(mimeType.Type().AsString(), nullptr)) {
+  if (DirectShowDecoder::GetSupportedCodecs(aType.GetMIMEType(), nullptr)) {
     return CANPLAY_MAYBE;
   }
 #endif
 #ifdef MOZ_ANDROID_OMX
   if (MediaDecoder::IsAndroidMediaPluginEnabled() &&
-      EnsureAndroidMediaPluginHost()->FindDecoder(mimeType.Type().AsString(), nullptr)) {
+      EnsureAndroidMediaPluginHost()->FindDecoder(aType.GetMIMEType(), nullptr)) {
     return CANPLAY_MAYBE;
   }
 #endif
   return CANPLAY_NO;
 }
 
 /* static */
 CanPlayStatus
--- a/dom/media/MediaContentType.cpp
+++ b/dom/media/MediaContentType.cpp
@@ -5,30 +5,66 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MediaContentType.h"
 
 #include "nsContentTypeParser.h"
 
 namespace mozilla {
 
-size_t
-MediaContentType::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
+static int32_t
+GetParameterAsNumber(const nsContentTypeParser& aParser,
+                     const char* aParameter,
+                     const int32_t aErrorReturn)
+{
+  nsAutoString parameterString;
+  nsresult rv = aParser.GetParameter(aParameter, parameterString);
+  if (NS_FAILED_impl(rv)) {
+    return aErrorReturn;
+  }
+  int32_t number = parameterString.ToInteger(&rv);
+  if (MOZ_UNLIKELY(NS_FAILED_impl(rv))) {
+    return aErrorReturn;
+  }
+  return number;
+}
+
+bool
+MediaContentType::Populate(const nsAString& aType)
 {
-  return mExtendedMIMEType.SizeOfExcludingThis(aMallocSizeOf);
+  MOZ_ASSERT(NS_IsMainThread());
+
+  nsContentTypeParser parser(aType);
+  nsAutoString mime;
+  nsresult rv = parser.GetType(mime);
+  if (!NS_SUCCEEDED(rv) || mime.IsEmpty()) {
+    return false;
+  }
+
+  mMIMEType = NS_ConvertUTF16toUTF8(mime);
+
+  rv = parser.GetParameter("codecs", mCodecs);
+  mHaveCodecs = NS_SUCCEEDED(rv);
+
+  mWidth = GetParameterAsNumber(parser, "width", -1);
+  mHeight = GetParameterAsNumber(parser, "height", -1);
+  mFramerate = GetParameterAsNumber(parser, "framerate", -1);
+  mBitrate = GetParameterAsNumber(parser, "bitrate", -1);
+
+  return true;
 }
 
 Maybe<MediaContentType>
 MakeMediaContentType(const nsAString& aType)
 {
-  Maybe<MediaExtendedMIMEType> mime = MakeMediaExtendedMIMEType(aType);
-  if (mime) {
-    return Some(MediaContentType(Move(*mime)));
+  Maybe<MediaContentType> type{Some(MediaContentType{})};
+  if (!type->Populate(aType)) {
+    type.reset();
   }
-  return Nothing();
+  return type;
 }
 
 Maybe<MediaContentType>
 MakeMediaContentType(const nsACString& aType)
 {
   return MakeMediaContentType(NS_ConvertUTF8toUTF16(aType));
 }
 
--- a/dom/media/MediaContentType.h
+++ b/dom/media/MediaContentType.h
@@ -2,52 +2,56 @@
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MediaContentType_h_
 #define MediaContentType_h_
 
-#include "MediaMIMETypes.h"
 #include "mozilla/Maybe.h"
 #include "nsString.h"
 
 namespace mozilla {
 
-// Class containing media type information for containers.
+// Structure containing pre-parsed content type parameters, e.g.:
+// MIME type, optional codecs, etc.
 class MediaContentType
 {
 public:
-  explicit MediaContentType(const MediaMIMEType& aType)
-    : mExtendedMIMEType(aType)
-  {}
-  explicit MediaContentType(MediaMIMEType&& aType)
-    : mExtendedMIMEType(Move(aType))
-  {}
-  explicit MediaContentType(const MediaExtendedMIMEType& aType)
-    : mExtendedMIMEType(aType)
+  // MIME type. Guaranteed not to be empty.
+  const nsACString& GetMIMEType() const { return mMIMEType; }
+
+  // Was there an explicit 'codecs' parameter provided?
+  bool HaveCodecs() const { return mHaveCodecs; }
+  // Codecs. May be empty if not provided or explicitly provided as empty.
+  const nsAString& GetCodecs() const { return mCodecs; }
+
+  // Sizes and rates.
+  Maybe<int32_t> GetWidth() const { return GetMaybeNumber(mWidth); }
+  Maybe<int32_t> GetHeight() const { return GetMaybeNumber(mHeight); }
+  Maybe<int32_t> GetFramerate() const { return GetMaybeNumber(mFramerate); }
+  Maybe<int32_t> GetBitrate() const { return GetMaybeNumber(mBitrate); }
+
+private:
+  friend Maybe<MediaContentType> MakeMediaContentType(const nsAString& aType);
+  bool Populate(const nsAString& aType);
+
+  Maybe<int32_t> GetMaybeNumber(int32_t aNumber) const
   {
-  }
-  explicit MediaContentType(MediaExtendedMIMEType&& aType)
-    : mExtendedMIMEType(Move(aType))
-  {
+    return (aNumber < 0) ? Maybe<int32_t>(Nothing()) : Some(int32_t(aNumber));
   }
 
-  const MediaMIMEType& Type() const { return mExtendedMIMEType.Type(); }
-  const MediaExtendedMIMEType& ExtendedType() const { return mExtendedMIMEType; }
-
-  // Original string. Note that "type/subtype" may not be lowercase,
-  // use Type().AsString() instead to get the normalized "type/subtype".
-  const nsACString& OriginalString() const { return mExtendedMIMEType.OriginalString(); }
-
-  size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
-
-private:
-  MediaExtendedMIMEType mExtendedMIMEType;
+  nsCString mMIMEType; // UTF8 MIME type.
+  bool mHaveCodecs; // If false, mCodecs must be empty.
+  nsString mCodecs;
+  int32_t mWidth; // -1 if not provided.
+  int32_t mHeight; // -1 if not provided.
+  int32_t mFramerate; // -1 if not provided.
+  int32_t mBitrate; // -1 if not provided.
 };
 
 Maybe<MediaContentType> MakeMediaContentType(const nsAString& aType);
 Maybe<MediaContentType> MakeMediaContentType(const nsACString& aType);
 Maybe<MediaContentType> MakeMediaContentType(const char* aType);
 
 } // namespace mozilla
 
deleted file mode 100644
--- a/dom/media/MediaMIMETypes.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "MediaMIMETypes.h"
-
-#include "nsContentTypeParser.h"
-
-namespace mozilla {
-
-template <int N>
-static bool
-StartsWith(const nsACString& string, const char (&prefix)[N])
-{
-    if (N - 1 > string.Length()) {
-      return false;
-    }
-    return memcmp(string.Data(), prefix, N - 1) == 0;
-}
-
-bool
-MediaMIMEType::HasApplicationMajorType() const
-{
-  return StartsWith(mMIMEType, "application/");
-}
-
-bool
-MediaMIMEType::HasAudioMajorType() const
-{
-  return StartsWith(mMIMEType, "audio/");
-}
-
-bool
-MediaMIMEType::HasVideoMajorType() const
-{
-  return StartsWith(mMIMEType, "video/");
-}
-
-size_t
-MediaMIMEType::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
-{
-  return mMIMEType.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
-}
-
-MediaMIMEType::MediaMIMEType(const nsACString& aType)
-  : mMIMEType(aType)
-{
-}
-
-Maybe<MediaMIMEType>
-MakeMediaMIMEType(const nsAString& aType)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  nsContentTypeParser parser(aType);
-  nsAutoString mime;
-  nsresult rv = parser.GetType(mime);
-  if (!NS_SUCCEEDED(rv) || mime.IsEmpty()) {
-    return Nothing();
-  }
-
-  NS_ConvertUTF16toUTF8 mime8{mime};
-  if (!IsMediaMIMEType(mime8)) {
-    return Nothing();
-  }
-
-  return Some(MediaMIMEType(mime8));
-}
-
-Maybe<MediaMIMEType>
-MakeMediaMIMEType(const nsACString& aType)
-{
-  return MakeMediaMIMEType(NS_ConvertUTF8toUTF16(aType));
-}
-
-Maybe<MediaMIMEType>
-MakeMediaMIMEType(const char* aType)
-{
-  if (!aType) {
-    return Nothing();
-  }
-  return MakeMediaMIMEType(nsDependentCString(aType));
-}
-
-bool
-MediaCodecs::Contains(const nsAString& aCodec) const
-{
-  for (const auto& myCodec : Range()) {
-    if (myCodec == aCodec) {
-      return true;
-    }
-  }
-  return false;
-}
-
-bool
-MediaCodecs::ContainsAll(const MediaCodecs& aCodecs) const
-{
-  const auto& codecsToTest = aCodecs.Range();
-  for (const auto& codecToTest : codecsToTest) {
-    if (!Contains(codecToTest)) {
-      return false;
-    }
-  }
-  return true;
-}
-
-size_t
-MediaCodecs::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
-{
-  return mCodecs.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
-}
-
-
-static int32_t
-GetParameterAsNumber(const nsContentTypeParser& aParser,
-                     const char* aParameter,
-                     const int32_t aErrorReturn)
-{
-  nsAutoString parameterString;
-  nsresult rv = aParser.GetParameter(aParameter, parameterString);
-  if (NS_FAILED_impl(rv)) {
-    return aErrorReturn;
-  }
-  int32_t number = parameterString.ToInteger(&rv);
-  if (MOZ_UNLIKELY(NS_FAILED_impl(rv))) {
-    return aErrorReturn;
-  }
-  return number;
-}
-
-MediaExtendedMIMEType::MediaExtendedMIMEType(const nsACString& aOriginalString,
-                                             const nsACString& aMIMEType,
-                                             bool aHaveCodecs,
-                                             const nsAString& aCodecs,
-                                             int32_t aWidth, int32_t aHeight,
-                                             int32_t aFramerate, int32_t aBitrate)
-  : mOriginalString(aOriginalString)
-  , mMIMEType(aMIMEType)
-  , mHaveCodecs(aHaveCodecs)
-  , mCodecs(aCodecs)
-  , mWidth(aWidth)
-  , mHeight(aHeight)
-  , mFramerate(aFramerate)
-  , mBitrate(aBitrate)
-{
-}
-
-MediaExtendedMIMEType::MediaExtendedMIMEType(const MediaMIMEType& aType)
-  : mOriginalString(aType.AsString())
-  , mMIMEType(aType)
-{
-}
-
-MediaExtendedMIMEType::MediaExtendedMIMEType(MediaMIMEType&& aType)
-  : mOriginalString(aType.AsString())
-  , mMIMEType(Move(aType))
-{
-}
-
-Maybe<MediaExtendedMIMEType>
-MakeMediaExtendedMIMEType(const nsAString& aType)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  nsContentTypeParser parser(aType);
-  nsAutoString mime;
-  nsresult rv = parser.GetType(mime);
-  if (!NS_SUCCEEDED(rv) || mime.IsEmpty()) {
-    return Nothing();
-  }
-
-  NS_ConvertUTF16toUTF8 mime8{mime};
-  if (!IsMediaMIMEType(mime8)) {
-    return Nothing();
-  }
-
-  nsAutoString codecs;
-  rv = parser.GetParameter("codecs", codecs);
-  bool haveCodecs = NS_SUCCEEDED(rv);
-
-  int32_t width = GetParameterAsNumber(parser, "width", -1);
-  int32_t height = GetParameterAsNumber(parser, "height", -1);
-  int32_t framerate = GetParameterAsNumber(parser, "framerate", -1);
-  int32_t bitrate = GetParameterAsNumber(parser, "bitrate", -1);
-
-  return Some(MediaExtendedMIMEType(NS_ConvertUTF16toUTF8(aType),
-                                    mime8,
-                                    haveCodecs, codecs,
-                                    width, height,
-                                    framerate, bitrate));
-}
-
-size_t
-MediaExtendedMIMEType::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
-{
-  return mOriginalString.SizeOfExcludingThisIfUnshared(aMallocSizeOf)
-         + mMIMEType.SizeOfExcludingThis(aMallocSizeOf)
-         + mCodecs.SizeOfExcludingThis(aMallocSizeOf);
-}
-
-Maybe<MediaExtendedMIMEType>
-MakeMediaExtendedMIMEType(const nsACString& aType)
-{
-  return MakeMediaExtendedMIMEType(NS_ConvertUTF8toUTF16(aType));
-}
-
-Maybe<MediaExtendedMIMEType>
-MakeMediaExtendedMIMEType(const char* aType)
-{
-  if (!aType) {
-    return Nothing();
-  }
-  return MakeMediaExtendedMIMEType(nsDependentCString(aType));
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/dom/media/MediaMIMETypes.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef MediaMIMETypes_h_
-#define MediaMIMETypes_h_
-
-#include "mozilla/Maybe.h"
-#include "nsString.h"
-#include "VideoUtils.h"
-
-namespace mozilla {
-
-// Class containing pointing at a media MIME "type/subtype" string literal.
-// See IsMediaMIMEType for restrictions.
-// Mainly used to help construct a MediaMIMEType through the statically-checked
-// MEDIAMIMETYPE macro, or to compare a MediaMIMEType to a literal.
-class DependentMediaMIMEType
-{
-public:
-  // Construction from a literal. Checked in debug builds.
-  // Use MEDIAMIMETYPE macro instead, for static checking.
-  template <size_t N>
-  explicit DependentMediaMIMEType(const char (&aType)[N])
-    : mMIMEType(aType, N - 1)
-  {
-    MOZ_ASSERT(IsMediaMIMEType(aType, N - 1), "Invalid media MIME type");
-  }
-
-  // MIME "type/subtype".
-  const nsDependentCString& AsDependentString() const { return mMIMEType; }
-
-private:
-  nsDependentCString mMIMEType;
-};
-
-// Instantiate a DependentMediaMIMEType from a literal. Statically checked.
-#define MEDIAMIMETYPE(LIT)                                            \
-  static_cast<const DependentMediaMIMEType&>(                         \
-    []() {                                                            \
-      static_assert(IsMediaMIMEType(LIT), "Invalid media MIME type"); \
-      return DependentMediaMIMEType(LIT);                             \
-    }())
-
-// Class containing only pre-parsed lowercase media MIME type/subtype.
-class MediaMIMEType
-{
-public:
-  // Construction from a DependentMediaMIMEType, with its inherent checks.
-  // Implicit so MEDIAMIMETYPE can be used wherever a MediaMIMEType is expected.
-  MOZ_IMPLICIT MediaMIMEType(const DependentMediaMIMEType& aType)
-    : mMIMEType(aType.AsDependentString())
-  {}
-
-  // MIME "type/subtype", always lowercase.
-  const nsACString& AsString() const { return mMIMEType; }
-
-  // Comparison with DependentMediaMIMEType.
-  // Useful to compare to MEDIAMIMETYPE literals.
-  bool operator==(const DependentMediaMIMEType& aOther) const
-  {
-    return mMIMEType.Equals(aOther.AsDependentString());
-  }
-  bool operator!=(const DependentMediaMIMEType& aOther) const
-  {
-    return !mMIMEType.Equals(aOther.AsDependentString());
-  }
-
-  bool operator==(const MediaMIMEType& aOther) const
-  {
-    return mMIMEType.Equals(aOther.mMIMEType);
-  }
-  bool operator!=(const MediaMIMEType& aOther) const
-  {
-    return !mMIMEType.Equals(aOther.mMIMEType);
-  }
-
-  // True if type starts with "application/".
-  bool HasApplicationMajorType() const;
-  // True if type starts with "audio/".
-  // Note that some audio content could be stored in a "video/..." container!
-  bool HasAudioMajorType() const;
-  // True if type starts with "video/".
-  // Note that this does not guarantee 100% that the content is actually video!
-  // (e.g., "video/webm" could contain a vorbis audio track.)
-  bool HasVideoMajorType() const;
-
-  size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
-
-private:
-  friend Maybe<MediaMIMEType> MakeMediaMIMEType(const nsAString& aType);
-  friend class MediaExtendedMIMEType;
-  explicit MediaMIMEType(const nsACString& aType);
-
-  nsCString mMIMEType; // UTF8 MIME "type/subtype".
-};
-
-Maybe<MediaMIMEType> MakeMediaMIMEType(const nsAString& aType);
-Maybe<MediaMIMEType> MakeMediaMIMEType(const nsACString& aType);
-Maybe<MediaMIMEType> MakeMediaMIMEType(const char* aType);
-
-
-// A list of codecs attached to a MediaExtendedMIMEType.
-class MediaCodecs
-{
-public:
-  MediaCodecs() {}
-  // Construction from a comma-separated list of codecs. Unchecked.
-  explicit MediaCodecs(const nsAString& aCodecs)
-    : mCodecs(aCodecs)
-  {}
-  // Construction from a literal comma-separated list of codecs. Unchecked.
-  template <size_t N>
-  explicit MediaCodecs(const char (&aCodecs)[N])
-    : mCodecs(NS_ConvertUTF8toUTF16(aCodecs, N - 1))
-  {}
-
-  bool IsEmpty() const { return mCodecs.IsEmpty(); }
-  const nsAString& AsString() const { return mCodecs; }
-
-  using RangeType =
-    const StringListRange<nsString, StringListRangeEmptyItems::ProcessEmptyItems>;
-
-  // Produces a range object with begin()&end(), can be used in range-for loops.
-  // This will iterate through all codecs, even empty ones (except if the
-  // original list was an empty string). Iterators dereference to
-  // 'const nsDependentString', valid for as long as this MediaCodecs object.
-  RangeType Range() const
-  {
-    return RangeType(mCodecs);
-  };
-
-  bool Contains(const nsAString& aCodec) const;
-  bool ContainsAll(const MediaCodecs& aCodecs) const;
-
-  size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
-
-private:
-  // UTF16 comma-separated list of codecs.
-  // See http://www.rfc-editor.org/rfc/rfc4281.txt for the description
-  // of the 'codecs' parameter.
-  nsString mCodecs;
-};
-
-
-// Class containing pre-parsed media MIME type parameters, e.g.:
-// MIME type/subtype, optional codecs, etc.
-class MediaExtendedMIMEType
-{
-public:
-  explicit MediaExtendedMIMEType(const MediaMIMEType& aType);
-  explicit MediaExtendedMIMEType(MediaMIMEType&& aType);
-
-  // MIME "type/subtype".
-  const MediaMIMEType& Type() const { return mMIMEType; }
-
-  // Was there an explicit 'codecs' parameter provided?
-  bool HaveCodecs() const { return mHaveCodecs; }
-  // Codecs. May be empty if not provided or explicitly provided as empty.
-  const MediaCodecs& Codecs() const { return mCodecs; }
-
-  // Sizes and rates.
-  Maybe<int32_t> GetWidth() const { return GetMaybeNumber(mWidth); }
-  Maybe<int32_t> GetHeight() const { return GetMaybeNumber(mHeight); }
-  Maybe<int32_t> GetFramerate() const { return GetMaybeNumber(mFramerate); }
-  Maybe<int32_t> GetBitrate() const { return GetMaybeNumber(mBitrate); }
-
-  // Original string. Note that "type/subtype" may not be lowercase,
-  // use Type().AsString() instead to get the normalized "type/subtype".
-  const nsACString& OriginalString() const { return mOriginalString; }
-
-  size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
-
-private:
-  friend Maybe<MediaExtendedMIMEType> MakeMediaExtendedMIMEType(const nsAString& aType);
-  MediaExtendedMIMEType(const nsACString& aOriginalString,
-                        const nsACString& aMIMEType,
-                        bool aHaveCodecs, const nsAString& aCodecs,
-                        int32_t aWidth, int32_t aHeight,
-                        int32_t aFramerate, int32_t aBitrate);
-
-  Maybe<int32_t> GetMaybeNumber(int32_t aNumber) const
-  {
-    return (aNumber < 0) ? Maybe<int32_t>(Nothing()) : Some(int32_t(aNumber));
-  }
-
-  nsCString mOriginalString; // Original full string.
-  MediaMIMEType mMIMEType; // MIME type/subtype.
-  bool mHaveCodecs = false; // If false, mCodecs must be empty.
-  MediaCodecs mCodecs;
-  int32_t mWidth = -1; // -1 if not provided.
-  int32_t mHeight = -1; // -1 if not provided.
-  int32_t mFramerate = -1; // -1 if not provided.
-  int32_t mBitrate = -1; // -1 if not provided.
-};
-
-Maybe<MediaExtendedMIMEType> MakeMediaExtendedMIMEType(const nsAString& aType);
-Maybe<MediaExtendedMIMEType> MakeMediaExtendedMIMEType(const nsACString& aType);
-Maybe<MediaExtendedMIMEType> MakeMediaExtendedMIMEType(const char* aType);
-
-} // namespace mozilla
-
-#endif // MediaMIMETypes_h_
--- a/dom/media/MediaStreamListener.h
+++ b/dom/media/MediaStreamListener.h
@@ -4,18 +4,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_MEDIASTREAMLISTENER_h_
 #define MOZILLA_MEDIASTREAMLISTENER_h_
 
 #include "StreamTracks.h"
 
-#include "MediaStreamGraph.h"
-
 namespace mozilla {
 
 class AudioSegment;
 class MediaStream;
 class MediaStreamGraph;
 class MediaStreamVideoSink;
 class VideoSegment;
 
--- a/dom/media/VideoUtils.cpp
+++ b/dom/media/VideoUtils.cpp
@@ -505,21 +505,21 @@ UniquePtr<TrackInfo>
 CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
   const nsACString& aCodecMIMEType,
   const MediaContentType& aContentType)
 {
   UniquePtr<TrackInfo> trackInfo = CreateTrackInfoWithMIMEType(aCodecMIMEType);
   if (trackInfo) {
     VideoInfo* videoInfo = trackInfo->GetAsVideoInfo();
     if (videoInfo) {
-      Maybe<int32_t> maybeWidth = aContentType.ExtendedType().GetWidth();
+      Maybe<int32_t> maybeWidth = aContentType.GetWidth();
       if (maybeWidth && *maybeWidth > 0) {
         videoInfo->mImage.width = *maybeWidth;
       }
-      Maybe<int32_t> maybeHeight = aContentType.ExtendedType().GetHeight();
+      Maybe<int32_t> maybeHeight = aContentType.GetHeight();
       if (maybeHeight && *maybeHeight > 0) {
         videoInfo->mImage.height = *maybeHeight;
       }
     }
   }
   return trackInfo;
 }
 
--- a/dom/media/VideoUtils.h
+++ b/dom/media/VideoUtils.h
@@ -357,86 +357,16 @@ CreateTrackInfoWithMIMEType(const nsACSt
 
 // Try and create a TrackInfo with a given codec MIME type, and optional extra
 // parameters from a content type (its MIME type and codecs are ignored).
 UniquePtr<TrackInfo>
 CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
   const nsACString& aCodecMIMEType,
   const MediaContentType& aContentType);
 
-namespace detail {
-
-// aString should start with aMajor + '/'.
-constexpr bool
-StartsWithMIMETypeMajor(const char* aString,
-                        const char* aMajor, size_t aMajorRemaining)
-{
-  return (aMajorRemaining == 0 && *aString == '/')
-         || (*aString == *aMajor
-             && StartsWithMIMETypeMajor(aString + 1,
-                                        aMajor + 1, aMajorRemaining - 1));
-}
-
-// aString should only contain [a-z0-9\-\.] and a final '\0'.
-constexpr bool
-EndsWithMIMESubtype(const char* aString, size_t aRemaining)
-{
-  return aRemaining == 0
-         || (((*aString >= 'a' && *aString <= 'z')
-              || (*aString >= '0' && *aString <= '9')
-              || *aString == '-'
-              || *aString == '.')
-             && EndsWithMIMESubtype(aString + 1, aRemaining - 1));
-}
-
-// Simple MIME-type literal string checker with a given (major) type.
-// Only accepts "{aMajor}/[a-z0-9\-\.]+".
-template <size_t MajorLengthPlus1>
-constexpr bool
-IsMIMETypeWithMajor(const char* aString, size_t aLength,
-                    const char (&aMajor)[MajorLengthPlus1])
-{
-  return aLength > MajorLengthPlus1 // Major + '/' + at least 1 char
-         && StartsWithMIMETypeMajor(aString, aMajor, MajorLengthPlus1 - 1)
-         && EndsWithMIMESubtype(aString + MajorLengthPlus1,
-                                aLength - MajorLengthPlus1);
-}
-
-} // namespace detail
-
-// Simple MIME-type string checker.
-// Only accepts lowercase "{application,audio,video}/[a-z0-9\-\.]+".
-// Add more if necessary.
-constexpr bool
-IsMediaMIMEType(const char* aString, size_t aLength)
-{
-  return detail::IsMIMETypeWithMajor(aString, aLength, "application")
-         || detail::IsMIMETypeWithMajor(aString, aLength, "audio")
-         || detail::IsMIMETypeWithMajor(aString, aLength, "video");
-}
-
-// Simple MIME-type string literal checker.
-// Only accepts lowercase "{application,audio,video}/[a-z0-9\-\.]+".
-// Add more if necessary.
-template <size_t LengthPlus1>
-constexpr bool
-IsMediaMIMEType(const char (&aString)[LengthPlus1])
-{
-  return IsMediaMIMEType(aString, LengthPlus1 - 1);
-}
-
-// Simple MIME-type string checker.
-// Only accepts lowercase "{application,audio,video}/[a-z0-9\-\.]+".
-// Add more if necessary.
-inline bool
-IsMediaMIMEType(const nsACString& aString)
-{
-  return IsMediaMIMEType(aString.Data(), aString.Length());
-}
-
 enum class StringListRangeEmptyItems
 {
   // Skip all empty items (empty string will process nothing)
   // E.g.: "a,,b" -> ["a", "b"], "" -> nothing
   Skip,
   // Process all, except if string is empty
   // E.g.: "a,,b" -> ["a", "", "b"], "" -> nothing
   ProcessEmptyItems,
--- a/dom/media/fmp4/MP4Decoder.cpp
+++ b/dom/media/fmp4/MP4Decoder.cpp
@@ -72,48 +72,48 @@ MP4Decoder::CanHandleMediaType(const Med
 {
   if (!IsEnabled()) {
     return false;
   }
 
   // Whitelist MP4 types, so they explicitly match what we encounter on
   // the web, as opposed to what we use internally (i.e. what our demuxers
   // etc output).
-  const bool isMP4Audio = aType.Type() == MEDIAMIMETYPE("audio/mp4") ||
-                          aType.Type() == MEDIAMIMETYPE("audio/x-m4a");
+  const bool isMP4Audio = aType.GetMIMEType().EqualsASCII("audio/mp4") ||
+                          aType.GetMIMEType().EqualsASCII("audio/x-m4a");
   const bool isMP4Video =
   // On B2G, treat 3GPP as MP4 when Gonk PDM is available.
 #ifdef MOZ_GONK_MEDIACODEC
-      aType.Type() == MEDIAMIMETYPE(VIDEO_3GPP) ||
+      aType.GetMIMEType().EqualsASCII(VIDEO_3GPP) ||
 #endif
-      aType.Type() == MEDIAMIMETYPE("video/mp4") ||
-      aType.Type() == MEDIAMIMETYPE("video/quicktime") ||
-      aType.Type() == MEDIAMIMETYPE("video/x-m4v");
+      aType.GetMIMEType().EqualsASCII("video/mp4") ||
+      aType.GetMIMEType().EqualsASCII("video/quicktime") ||
+      aType.GetMIMEType().EqualsASCII("video/x-m4v");
   if (!isMP4Audio && !isMP4Video) {
     return false;
   }
 
   nsTArray<UniquePtr<TrackInfo>> trackInfos;
-  if (aType.ExtendedType().Codecs().IsEmpty()) {
+  if (aType.GetCodecs().IsEmpty()) {
     // No codecs specified. Assume H.264
     if (isMP4Audio) {
       trackInfos.AppendElement(
         CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
           NS_LITERAL_CSTRING("audio/mp4a-latm"), aType));
     } else {
       MOZ_ASSERT(isMP4Video);
       trackInfos.AppendElement(
         CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
           NS_LITERAL_CSTRING("video/avc"), aType));
     }
   } else {
     // Verify that all the codecs specified are ones that we expect that
     // we can play.
     nsTArray<nsString> codecs;
-    if (!ParseCodecsString(aType.ExtendedType().Codecs().AsString(), codecs)) {
+    if (!ParseCodecsString(aType.GetCodecs(), codecs)) {
       return false;
     }
     for (const nsString& codec : codecs) {
       if (IsAACCodecString(codec)) {
         trackInfos.AppendElement(
           CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
             NS_LITERAL_CSTRING("audio/mp4a-latm"), aType));
         continue;
deleted file mode 100644
--- a/dom/media/gtest/TestMediaMIMETypes.cpp
+++ /dev/null
@@ -1,237 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "gtest/gtest.h"
-#include "MediaContentType.h"
-
-using namespace mozilla;
-
-TEST(MediaMIMETypes, DependentMIMEType)
-{
-  static const struct
-  {
-    const char* mString;
-    DependentMediaMIMEType mDependentMediaMIMEType;
-  }
-  tests[] =
-  {
-    { "audio/mp4",         MEDIAMIMETYPE("audio/mp4")         },
-    { "video/mp4",         MEDIAMIMETYPE("video/mp4")         },
-    { "application/x-mp4", MEDIAMIMETYPE("application/x-mp4") }
-  };
-  for (const auto& test : tests) {
-    EXPECT_TRUE(test.mDependentMediaMIMEType.AsDependentString().EqualsASCII(test.mString));
-    MediaMIMEType mimetype(test.mDependentMediaMIMEType);
-    EXPECT_TRUE(mimetype.AsString().Equals(test.mDependentMediaMIMEType.AsDependentString()));
-    EXPECT_EQ(mimetype, test.mDependentMediaMIMEType);
-    EXPECT_EQ(mimetype, MediaMIMEType(test.mDependentMediaMIMEType));
-  }
-}
-
-TEST(MediaMIMETypes, MakeMediaMIMEType_bad)
-{
-  static const char* tests[] =
-  {
-    "",
-    " ",
-    "/",
-    "audio",
-    "audio/",
-    "mp4",
-    "/mp4",
-    "a/b"
-  };
-
-  for (const auto& test : tests) {
-    Maybe<MediaMIMEType> type = MakeMediaMIMEType(test);
-    EXPECT_TRUE(type.isNothing())
-      << "MakeMediaMIMEType(\"" << test << "\").isNothing()";
-  }
-}
-
-TEST(MediaMIMETypes, MediaMIMEType)
-{
-  static const struct
-  {
-    const char* mTypeString;
-    const char* mAsString;
-    bool mApplication;
-    bool mAudio;
-    bool mVideo;
-    bool mEqualsLiteralVideoSlashMp4; // tests `== "video/mp4"`
-  } tests[] =
-  { // in                    AsString         app    audio  video  ==v/mp4
-    { "video/mp4",           "video/mp4",     false, false, true,  true  },
-    { "video/mp4; codecs=0", "video/mp4",     false, false, true,  true  },
-    { "VIDEO/MP4",           "video/mp4",     false, false, true,  true  },
-    { "audio/mp4",           "audio/mp4",     false, true,  false, false },
-    { "application/x",       "application/x", true, false,  false, false }
-  };
-
-  for (const auto& test : tests) {
-    Maybe<MediaMIMEType> type = MakeMediaMIMEType(test.mTypeString);
-    EXPECT_TRUE(type.isSome())
-      << "MakeMediaMIMEType(\"" << test.mTypeString << "\").isSome()";
-    EXPECT_TRUE(type->AsString().EqualsASCII(test.mAsString))
-      << "MakeMediaMIMEType(\"" << test.mTypeString << "\")->AsString() == \"" << test.mAsString << "\"";
-    EXPECT_EQ(test.mApplication, type->HasApplicationMajorType())
-      << "MakeMediaMIMEType(\"" << test.mTypeString << "\")->HasApplicationMajorType() == " << (test.mApplication ? "true" : "false");
-    EXPECT_EQ(test.mAudio, type->HasAudioMajorType())
-      << "MakeMediaMIMEType(\"" << test.mTypeString << "\")->HasAudioMajorType() == " << (test.mAudio ? "true" : "false");
-    EXPECT_EQ(test.mVideo, type->HasVideoMajorType())
-      << "MakeMediaMIMEType(\"" << test.mTypeString << "\")->HasVideoMajorType() == " << (test.mVideo ? "true" : "false");
-    EXPECT_EQ(test.mEqualsLiteralVideoSlashMp4, *type == MEDIAMIMETYPE("video/mp4"))
-      << "*MakeMediaMIMEType(\"" << test.mTypeString << "\") == MEDIAMIMETYPE(\"video/mp4\")";
-  }
-}
-
-TEST(MediaMIMETypes, MediaCodecs)
-{
-  MediaCodecs empty("");
-  EXPECT_TRUE(empty.IsEmpty());
-  EXPECT_TRUE(empty.AsString().EqualsLiteral(""));
-  EXPECT_FALSE(empty.Contains(NS_LITERAL_STRING("")));
-  EXPECT_FALSE(empty.Contains(NS_LITERAL_STRING("c1")));
-  int iterations = 0;
-  for (const auto& codec : empty.Range()) {
-    ++iterations;
-    Unused << codec;
-  }
-  EXPECT_EQ(0, iterations);
-
-  MediaCodecs space(" ");
-  EXPECT_FALSE(space.IsEmpty());
-  EXPECT_TRUE(space.AsString().EqualsLiteral(" "));
-  EXPECT_TRUE(space.Contains(NS_LITERAL_STRING("")));
-  EXPECT_FALSE(space.Contains(NS_LITERAL_STRING("c1")));
-  iterations = 0;
-  for (const auto& codec : space.Range()) {
-    ++iterations;
-    EXPECT_TRUE(codec.IsEmpty());
-  }
-  EXPECT_EQ(1, iterations);
-
-  MediaCodecs one(" c1 ");
-  EXPECT_FALSE(one.IsEmpty());
-  EXPECT_TRUE(one.AsString().EqualsLiteral(" c1 "));
-  EXPECT_FALSE(one.Contains(NS_LITERAL_STRING("")));
-  EXPECT_TRUE(one.Contains(NS_LITERAL_STRING("c1")));
-  iterations = 0;
-  for (const auto& codec : one.Range()) {
-    ++iterations;
-    EXPECT_TRUE(codec.EqualsLiteral("c1"));
-  }
-  EXPECT_EQ(1, iterations);
-
-  MediaCodecs two(" c1 , c2 ");
-  EXPECT_FALSE(two.IsEmpty());
-  EXPECT_TRUE(two.AsString().EqualsLiteral(" c1 , c2 "));
-  EXPECT_FALSE(two.Contains(NS_LITERAL_STRING("")));
-  EXPECT_TRUE(two.Contains(NS_LITERAL_STRING("c1")));
-  EXPECT_TRUE(two.Contains(NS_LITERAL_STRING("c2")));
-  iterations = 0;
-  for (const auto& codec : two.Range()) {
-    ++iterations;
-    char buffer[] = "c0";
-    buffer[1] += iterations;
-    EXPECT_TRUE(codec.EqualsASCII(buffer));
-  }
-  EXPECT_EQ(2, iterations);
-
-  EXPECT_TRUE(two.ContainsAll(two));
-  EXPECT_TRUE(two.ContainsAll(one));
-  EXPECT_FALSE(one.ContainsAll(two));
-}
-
-TEST(MediaMIMETypes, MakeMediaExtendedMIMEType_bad)
-{
-  static const char* tests[] =
-  {
-    "",
-    " ",
-    "/",
-    "audio",
-    "audio/",
-    "mp4",
-    "/mp4",
-    "a/b"
-  };
-
-  for (const auto& test : tests) {
-    Maybe<MediaExtendedMIMEType> type = MakeMediaExtendedMIMEType(test);
-    EXPECT_TRUE(type.isNothing())
-      << "MakeMediaExtendedMIMEType(\"" << test << "\").isNothing()";
-  }
-}
-
-TEST(MediaMIMETypes, MediaExtendedMIMEType)
-{
-  // Some generic tests first.
-  static const struct
-  {
-    const char* mTypeString;
-    const char* mTypeAsString;
-    bool mApplication;
-    bool mAudio;
-    bool mVideo;
-    bool mEqualsLiteralVideoSlashMp4; // tests `== "video/mp4"`
-    bool mHaveCodecs;
-  } tests[] =
-  { // in                    Type().AsString  app    audio  video ==v/mp4 codecs
-    { "video/mp4",           "video/mp4",     false, false, true,  true,  false },
-    { "video/mp4; codecs=0", "video/mp4",     false, false, true,  true,  true  },
-    { "VIDEO/MP4",           "video/mp4",     false, false, true,  true,  false },
-    { "audio/mp4",           "audio/mp4",     false, true,  false, false, false },
-    { "application/x",       "application/x", true, false,  false, false, false }
-  };
-
-  for (const auto& test : tests) {
-    Maybe<MediaExtendedMIMEType> type = MakeMediaExtendedMIMEType(test.mTypeString);
-    EXPECT_TRUE(type.isSome())
-      << "MakeMediaExtendedMIMEType(\"" << test.mTypeString << "\").isSome()";
-    EXPECT_TRUE(type->OriginalString().EqualsASCII(test.mTypeString))
-      << "MakeMediaExtendedMIMEType(\"" << test.mTypeString << "\")->AsString() == \"" << test.mTypeAsString << "\"";
-    EXPECT_TRUE(type->Type().AsString().EqualsASCII(test.mTypeAsString))
-      << "MakeMediaExtendedMIMEType(\"" << test.mTypeString << "\")->AsString() == \"" << test.mTypeAsString << "\"";
-    EXPECT_EQ(test.mApplication, type->Type().HasApplicationMajorType())
-      << "MakeMediaExtendedMIMEType(\"" << test.mTypeString << "\")->Type().HasApplicationMajorType() == " << (test.mApplication ? "true" : "false");
-    EXPECT_EQ(test.mAudio, type->Type().HasAudioMajorType())
-      << "MakeMediaExtendedMIMEType(\"" << test.mTypeString << "\")->Type().HasAudioMajorType() == " << (test.mAudio ? "true" : "false");
-    EXPECT_EQ(test.mVideo, type->Type().HasVideoMajorType())
-      << "MakeMediaExtendedMIMEType(\"" << test.mTypeString << "\")->Type().HasVideoMajorType() == " << (test.mVideo ? "true" : "false");
-    EXPECT_EQ(test.mEqualsLiteralVideoSlashMp4, type->Type() == MEDIAMIMETYPE("video/mp4"))
-      << "*MakeMediaExtendedMIMEType(\"" << test.mTypeString << "\")->Type() == MEDIAMIMETYPE(\"video/mp4\")";
-    EXPECT_EQ(test.mHaveCodecs, type->HaveCodecs())
-      << "MakeMediaExtendedMIMEType(\"" << test.mTypeString << "\")->HaveCodecs() == " << (test.mHaveCodecs ? "true" : "false");
-    EXPECT_NE(test.mHaveCodecs, type->Codecs().IsEmpty())
-      << "MakeMediaExtendedMIMEType(\"" << test.mTypeString << "\")->Codecs.IsEmpty() != " << (test.mHaveCodecs ? "true" : "false");
-    EXPECT_FALSE(type->GetWidth())
-      << "MakeMediaExtendedMIMEType(\"" << test.mTypeString << "\")->GetWidth()";
-    EXPECT_FALSE(type->GetHeight())
-      << "MakeMediaExtendedMIMEType(\"" << test.mTypeString << "\")->GetHeight()";
-    EXPECT_FALSE(type->GetFramerate())
-      << "MakeMediaExtendedMIMEType(\"" << test.mTypeString << "\")->GetFramerate()";
-    EXPECT_FALSE(type->GetBitrate())
-      << "MakeMediaExtendedMIMEType(\"" << test.mTypeString << "\")->GetBitrate()";
-  }
-
-  // Test all extra parameters.
-  Maybe<MediaExtendedMIMEType> type =
-    MakeMediaExtendedMIMEType(
-      "video/mp4; codecs=\"a,b\"; width=1024; Height=768; FrameRate=60; BITRATE=100000");
-  EXPECT_TRUE(type->HaveCodecs());
-  EXPECT_FALSE(type->Codecs().IsEmpty());
-  EXPECT_TRUE(type->Codecs().AsString().EqualsASCII("a,b"));
-  EXPECT_TRUE(type->Codecs().Contains(NS_LITERAL_STRING("a")));
-  EXPECT_TRUE(type->Codecs().Contains(NS_LITERAL_STRING("b")));
-  EXPECT_TRUE(!!type->GetWidth());
-  EXPECT_EQ(1024, *type->GetWidth());
-  EXPECT_TRUE(!!type->GetHeight());
-  EXPECT_EQ(768, *type->GetHeight());
-  EXPECT_TRUE(!!type->GetFramerate());
-  EXPECT_EQ(60, *type->GetFramerate());
-  EXPECT_TRUE(!!type->GetBitrate());
-  EXPECT_EQ(100000, *type->GetBitrate());
-}
--- a/dom/media/gtest/TestVideoUtils.cpp
+++ b/dom/media/gtest/TestVideoUtils.cpp
@@ -4,32 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "gtest/gtest.h"
 #include "nsString.h"
 #include "VideoUtils.h"
 
 using namespace mozilla;
 
-TEST(MediaMIMETypes, IsMediaMIMEType)
-{
-  EXPECT_TRUE(IsMediaMIMEType("audio/mp4"));
-  EXPECT_TRUE(IsMediaMIMEType("video/mp4"));
-  EXPECT_TRUE(IsMediaMIMEType("application/x-mp4"));
-
-  EXPECT_TRUE(IsMediaMIMEType("audio/m"));
-  EXPECT_FALSE(IsMediaMIMEType("audio/"));
-
-  EXPECT_FALSE(IsMediaMIMEType("vide/mp4"));
-  EXPECT_FALSE(IsMediaMIMEType("videos/mp4"));
-
-  // Expect lowercase only.
-  EXPECT_FALSE(IsMediaMIMEType("Video/mp4"));
-}
-
 TEST(StringListRange, MakeStringListRange)
 {
   static const struct
   {
     const char* mList;
     const char* mExpectedSkipEmpties;
     const char* mExpectedProcessAll;
     const char* mExpectedProcessEmpties;
--- a/dom/media/gtest/moz.build
+++ b/dom/media/gtest/moz.build
@@ -12,17 +12,16 @@ UNIFIED_SOURCES += [
     'TestAudioPacketizer.cpp',
     'TestAudioSegment.cpp',
     'TestGMPCrossOrigin.cpp',
     'TestGMPRemoveAndDelete.cpp',
     'TestGMPUtils.cpp',
     'TestIntervalSet.cpp',
     'TestMediaDataDecoder.cpp',
     'TestMediaEventSource.cpp',
-    'TestMediaMIMETypes.cpp',
     'TestMozPromise.cpp',
     'TestMP3Demuxer.cpp',
     'TestMP4Demuxer.cpp',
     # 'TestMP4Reader.cpp', disabled so we can turn check tests back on (bug 1175752)
     'TestTrackEncoder.cpp',
     'TestVideoSegment.cpp',
     'TestVideoUtils.cpp',
     'TestVPXDecoding.cpp',
--- a/dom/media/mediasource/MediaSource.cpp
+++ b/dom/media/mediasource/MediaSource.cpp
@@ -100,32 +100,31 @@ MediaSource::IsTypeSupported(const nsASt
 
   if (DecoderTraits::CanHandleContentType(*contentType, aDiagnostics)
       == CANPLAY_NO) {
     return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
   }
 
   // Now we know that this media type could be played.
   // MediaSource imposes extra restrictions, and some prefs.
-  const MediaMIMEType& mimeType = contentType->Type();
-  if (mimeType == MEDIAMIMETYPE("video/mp4") ||
-      mimeType == MEDIAMIMETYPE("audio/mp4")) {
+  const nsACString& mimeType = contentType->GetMIMEType();
+  if (mimeType.EqualsASCII("video/mp4") || mimeType.EqualsASCII("audio/mp4")) {
     if (!Preferences::GetBool("media.mediasource.mp4.enabled", false)) {
       return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
     }
     return NS_OK;
   }
-  if (mimeType == MEDIAMIMETYPE("video/webm")) {
+  if (mimeType.EqualsASCII("video/webm")) {
     if (!(Preferences::GetBool("media.mediasource.webm.enabled", false) ||
           IsWebMForced(aDiagnostics))) {
       return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
     }
     return NS_OK;
   }
-  if (mimeType == MEDIAMIMETYPE("audio/webm")) {
+  if (mimeType.EqualsASCII("audio/webm")) {
     if (!(Preferences::GetBool("media.mediasource.webm.enabled", false) ||
           Preferences::GetBool("media.mediasource.webm.audio.enabled", true))) {
       return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
     }
     return NS_OK;
   }
 
   return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
@@ -238,17 +237,17 @@ MediaSource::AddSourceBuffer(const nsASt
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return nullptr;
   }
   Maybe<MediaContentType> contentType = MakeMediaContentType(aType);
   if (!contentType) {
     aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
     return nullptr;
   }
-  const nsACString& mimeType = contentType->Type().AsString();
+  const nsACString& mimeType = contentType->GetMIMEType();
   RefPtr<SourceBuffer> sourceBuffer = new SourceBuffer(this, mimeType);
   if (!sourceBuffer) {
     aRv.Throw(NS_ERROR_FAILURE); // XXX need a better error here
     return nullptr;
   }
   mSourceBuffers->Append(sourceBuffer);
   MSE_DEBUG("sourceBuffer=%p", sourceBuffer.get());
   return sourceBuffer.forget();
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -106,17 +106,16 @@ EXPORTS += [
     'MediaDecoder.h',
     'MediaDecoderOwner.h',
     'MediaDecoderReader.h',
     'MediaDecoderStateMachine.h',
     'MediaEventSource.h',
     'MediaFormatReader.h',
     'MediaInfo.h',
     'MediaMetadataManager.h',
-    'MediaMIMETypes.h',
     'MediaPrefs.h',
     'MediaQueue.h',
     'MediaRecorder.h',
     'MediaResource.h',
     'MediaResourceCallback.h',
     'MediaResult.h',
     'MediaSegment.h',
     'MediaStatistics.h',
@@ -214,17 +213,16 @@ UNIFIED_SOURCES += [
     'MediaDecoderReader.cpp',
     'MediaDecoderReaderWrapper.cpp',
     'MediaDecoderStateMachine.cpp',
     'MediaDeviceInfo.cpp',
     'MediaDevices.cpp',
     'MediaFormatReader.cpp',
     'MediaInfo.cpp',
     'MediaManager.cpp',
-    'MediaMIMETypes.cpp',
     'MediaPrefs.cpp',
     'MediaRecorder.cpp',
     'MediaResource.cpp',
     'MediaShutdownManager.cpp',
     'MediaStreamError.cpp',
     'MediaStreamGraph.cpp',
     'MediaStreamListener.cpp',
     'MediaStreamTrack.cpp',