Bug 1316205: P3. Remove WaveDecoder::IsEnable(). r?gerald
It would always return true, and there's already a MediaDecoder::IsWaveEnabled()
MozReview-Commit-ID: 6FXgMRMnVb9
--- 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