Bug 1316205: P3. Remove WaveDecoder::IsEnable(). r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 10 Nov 2016 11:53:07 +1100
changeset 321885 60bf1293eabf295bef0dd400ebde9668af3bd9ae
parent 321884 133477f27fe6a4aa490cded021cbcb5dd025793d
child 321886 f6f28be8d8f25ff7ed865a0e8cfd11e36334e3cc
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersgerald
bugs1316205
milestone52.0a1
Bug 1316205: P3. Remove WaveDecoder::IsEnable(). r=gerald It would always return true, and there's already a MediaDecoder::IsWaveEnabled() MozReview-Commit-ID: 6FXgMRMnVb9
dom/media/wave/WaveDecoder.cpp
dom/media/wave/WaveDecoder.h
--- a/dom/media/wave/WaveDecoder.cpp
+++ b/dom/media/wave/WaveDecoder.cpp
@@ -22,33 +22,24 @@ MediaDecoderStateMachine*
 WaveDecoder::CreateStateMachine()
 {
   return new MediaDecoderStateMachine(
     this, new MediaFormatReader(this, new WAVDemuxer(GetResource())));
 }
 
 /* static */
 bool
-WaveDecoder::IsEnabled()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  RefPtr<PDMFactory> platform = new PDMFactory();
-  return platform->SupportsMimeType(NS_LITERAL_CSTRING("audio/x-wav"),
-                                    /* DecoderDoctorDiagnostics* */ nullptr);
-}
-
-/* static */
-bool
 WaveDecoder::CanHandleMediaType(const nsACString& aType,
                                 const nsAString& aCodecs)
 {
+  if (!IsWaveEnabled()) {
+    return false;
+  }
   if (aType.EqualsASCII("audio/wave") || aType.EqualsASCII("audio/x-wav") ||
       aType.EqualsASCII("audio/wav")  || aType.EqualsASCII("audio/x-pn-wav")) {
-    return IsEnabled() && (aCodecs.IsEmpty() ||
-                           aCodecs.EqualsASCII("1") ||
-                           aCodecs.EqualsASCII("6") ||
-                           aCodecs.EqualsASCII("7"));
+    return (aCodecs.IsEmpty() || aCodecs.EqualsASCII("1") ||
+            aCodecs.EqualsASCII("6") || aCodecs.EqualsASCII("7"));
   }
 
   return false;
 }
 
 } // namespace mozilla
--- a/dom/media/wave/WaveDecoder.h
+++ b/dom/media/wave/WaveDecoder.h
@@ -12,18 +12,15 @@ namespace mozilla {
 
 class WaveDecoder : public MediaDecoder {
 public:
   // MediaDecoder interface.
   explicit WaveDecoder(MediaDecoderOwner* aOwner) : MediaDecoder(aOwner) {}
   MediaDecoder* Clone(MediaDecoderOwner* aOwner) override;
   MediaDecoderStateMachine* CreateStateMachine() override;
 
-  // Returns true if the WAV backend is pref'ed on, and we're running on a
-  // platform that is likely to have decoders for the format.
-  static bool IsEnabled();
   static bool CanHandleMediaType(const nsACString& aType,
                                  const nsAString& aCodecs);
 };
 
 } // namespace mozilla
 
 #endif