Bug 1176218 - p6. Move ShouldHandleMediaType down the cpp - r=jya
authorGerald Squelart <gsquelart@mozilla.com>
Mon, 26 Sep 2016 16:02:59 +1000
changeset 317115 98a2b908e5bf2e18567d56b6f762fb8c46088b9c
parent 317114 6e810bc9458a8c0b65820a26b120830bafa37a02
child 317116 83eef2a47390dc4b7d36b5b1e3b7ebb9bbfb1df4
push id20681
push userphilringnalda@gmail.com
push dateSat, 08 Oct 2016 23:57:20 +0000
treeherderfx-team@7a7ba250bb2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1176218
milestone52.0a1
Bug 1176218 - p6. Move ShouldHandleMediaType down the cpp - r=jya Just moving a function, it will help review upcoming changes in the next patch. MozReview-Commit-ID: Ilbhinse9C6
dom/media/DecoderTraits.cpp
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -301,44 +301,16 @@ IsWAVSupportedType(const nsACString& aTy
 static bool
 IsFlacSupportedType(const nsACString& aType,
                    const nsAString& aCodecs = EmptyString())
 {
   return FlacDecoder::CanHandleMediaType(aType, aCodecs);
 }
 
 /* static */
-bool DecoderTraits::ShouldHandleMediaType(const char* aMIMEType,
-                                          DecoderDoctorDiagnostics* aDiagnostics)
-{
-  if (IsWaveType(nsDependentCString(aMIMEType))) {
-    // We should not return true for Wave types, since there are some
-    // Wave codecs actually in use in the wild that we don't support, and
-    // we should allow those to be handled by plugins or helper apps.
-    // Furthermore people can play Wave files on most platforms by other
-    // means.
-    return false;
-  }
-
-  // If an external plugin which can handle quicktime video is available
-  // (and not disabled), prefer it over native playback as there several
-  // codecs found in the wild that we do not handle.
-  if (nsDependentCString(aMIMEType).EqualsASCII("video/quicktime")) {
-    RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
-    if (pluginHost &&
-        pluginHost->HavePluginForType(nsDependentCString(aMIMEType))) {
-      return false;
-    }
-  }
-
-  return CanHandleMediaType(aMIMEType, false, EmptyString(), aDiagnostics)
-         != CANPLAY_NO;
-}
-
-/* static */
 CanPlayStatus
 DecoderTraits::CanHandleCodecsType(const char* aMIMEType,
                                    const nsAString& aRequestedCodecs,
                                    DecoderDoctorDiagnostics* aDiagnostics)
 {
   char const* const* codecList = nullptr;
   if (IsOggTypeAndEnabled(nsDependentCString(aMIMEType))) {
     if (IsOggSupportedType(nsDependentCString(aMIMEType), aRequestedCodecs)) {
@@ -503,16 +475,44 @@ DecoderTraits::CanHandleContentType(cons
   }
 
   return CanHandleMediaType(aContentType.GetMIMEType().Data(),
                             aContentType.HaveCodecs(),
                             aContentType.GetCodecs(),
                             aDiagnostics);
 }
 
+/* static */
+bool DecoderTraits::ShouldHandleMediaType(const char* aMIMEType,
+                                          DecoderDoctorDiagnostics* aDiagnostics)
+{
+  if (IsWaveType(nsDependentCString(aMIMEType))) {
+    // We should not return true for Wave types, since there are some
+    // Wave codecs actually in use in the wild that we don't support, and
+    // we should allow those to be handled by plugins or helper apps.
+    // Furthermore people can play Wave files on most platforms by other
+    // means.
+    return false;
+  }
+
+  // If an external plugin which can handle quicktime video is available
+  // (and not disabled), prefer it over native playback as there several
+  // codecs found in the wild that we do not handle.
+  if (nsDependentCString(aMIMEType).EqualsASCII("video/quicktime")) {
+    RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
+    if (pluginHost &&
+        pluginHost->HavePluginForType(nsDependentCString(aMIMEType))) {
+      return false;
+    }
+  }
+
+  return CanHandleMediaType(aMIMEType, false, EmptyString(), aDiagnostics)
+         != CANPLAY_NO;
+}
+
 // Instantiates but does not initialize decoder.
 static
 already_AddRefed<MediaDecoder>
 InstantiateDecoder(const nsACString& aType,
                    MediaDecoderOwner* aOwner,
                    DecoderDoctorDiagnostics* aDiagnostics)
 {
   MOZ_ASSERT(NS_IsMainThread());