diff options
Diffstat (limited to 'www/seamonkey/files/patch-bug1209410')
-rw-r--r-- | www/seamonkey/files/patch-bug1209410 | 169 |
1 files changed, 0 insertions, 169 deletions
diff --git a/www/seamonkey/files/patch-bug1209410 b/www/seamonkey/files/patch-bug1209410 deleted file mode 100644 index c20dda7fcac7..000000000000 --- a/www/seamonkey/files/patch-bug1209410 +++ /dev/null @@ -1,169 +0,0 @@ -# Use MP3Demuxer/MediaFormatReader by default when available - -diff --git a/dom/media/DecoderTraits.cpp b/dom/media/DecoderTraits.cpp ---- mozilla/dom/media/DecoderTraits.cpp -+++ mozilla/dom/media/DecoderTraits.cpp -@@ -200,10 +200,10 @@ DecoderTraits::IsWebMTypeAndEnabled(cons - static bool - IsGStreamerSupportedType(const nsACString& aMimeType) - { -- if (!MediaDecoder::IsGStreamerEnabled()) -+ if (DecoderTraits::IsWebMTypeAndEnabled(aMimeType)) - return false; - -- if (DecoderTraits::IsWebMTypeAndEnabled(aMimeType) && !Preferences::GetBool("media.prefer-gstreamer", false)) -+ if (!MediaDecoder::IsGStreamerEnabled()) - return false; - - if (IsOggType(aMimeType) && !Preferences::GetBool("media.prefer-gstreamer", false)) -@@ -366,7 +366,7 @@ static bool - IsMP3SupportedType(const nsACString& aType, - const nsAString& aCodecs = EmptyString()) - { -- return aType.EqualsASCII("audio/mpeg") && MP3Decoder::IsEnabled(); -+ return MP3Decoder::CanHandleMediaType(aType, aCodecs); - } - - #ifdef MOZ_APPLEMEDIA -diff --git a/dom/media/MP3Decoder.cpp b/dom/media/MP3Decoder.cpp ---- mozilla/dom/media/MP3Decoder.cpp -+++ mozilla/dom/media/MP3Decoder.cpp -@@ -10,10 +10,7 @@ - #include "MediaFormatReader.h" - #include "MP3Demuxer.h" - #include "mozilla/Preferences.h" -- --#ifdef MOZ_WIDGET_ANDROID --#include "AndroidBridge.h" --#endif -+#include "PlatformDecoderModule.h" - - namespace mozilla { - -@@ -32,14 +29,61 @@ MP3Decoder::CreateStateMachine() { - return new MediaDecoderStateMachine(this, reader); - } - -+static already_AddRefed<MediaDataDecoder> -+CreateTestMP3Decoder(AudioInfo& aConfig) -+{ -+ PlatformDecoderModule::Init(); -+ -+ nsRefPtr<PlatformDecoderModule> platform = PlatformDecoderModule::Create(); -+ if (!platform || !platform->SupportsMimeType(aConfig.mMimeType)) { -+ return nullptr; -+ } -+ -+ nsRefPtr<MediaDataDecoder> decoder( -+ platform->CreateDecoder(aConfig, nullptr, nullptr)); -+ if (!decoder) { -+ return nullptr; -+ } -+ -+ return decoder.forget(); -+} -+ -+static bool -+CanCreateMP3Decoder() -+{ -+ static bool haveCachedResult = false; -+ static bool result = false; -+ if (haveCachedResult) { -+ return result; -+ } -+ AudioInfo config; -+ config.mMimeType = "audio/mpeg"; -+ config.mRate = 48000; -+ config.mChannels = 2; -+ config.mBitDepth = 16; -+ nsRefPtr<MediaDataDecoder> decoder(CreateTestMP3Decoder(config)); -+ if (decoder) { -+ result = true; -+ } -+ haveCachedResult = true; -+ return result; -+} -+ -+/* static */ - bool - MP3Decoder::IsEnabled() { --#ifdef MOZ_WIDGET_ANDROID -- // We need android.media.MediaCodec which exists in API level 16 and higher. -- return AndroidBridge::Bridge()->GetAPIVersion() >= 16; --#else -- return Preferences::GetBool("media.mp3.enabled"); --#endif -+ return CanCreateMP3Decoder(); -+} -+ -+/* static */ -+bool MP3Decoder::CanHandleMediaType(const nsACString& aType, -+ const nsAString& aCodecs) -+{ -+ if (aType.EqualsASCII("audio/mp3") || aType.EqualsASCII("audio/mpeg")) { -+ return CanCreateMP3Decoder() && -+ (aCodecs.IsEmpty() || aCodecs.EqualsASCII("mp3")); -+ } -+ return false; - } - - } // namespace mozilla -diff --git a/dom/media/MP3Decoder.h b/dom/media/MP3Decoder.h ---- mozilla/dom/media/MP3Decoder.h -+++ mozilla/dom/media/MP3Decoder.h -@@ -19,6 +19,8 @@ public: - // Returns true if the MP3 backend is preffed 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 -diff --git a/dom/media/test/manifest.js b/dom/media/test/manifest.js ---- mozilla/dom/media/test/manifest.js -+++ mozilla/dom/media/test/manifest.js -@@ -76,7 +76,7 @@ var gPlayedTests = [ - { name:"seek.ogv", type:"video/ogg", duration:3.966 }, - { name:"seek.webm", type:"video/webm", duration:3.966 }, - { name:"gizmo.mp4", type:"video/mp4", duration:5.56 }, -- { name:"owl.mp3", type:"audio/mpeg", duration:3.29 }, -+ { name:"owl.mp3", type:"audio/mpeg", duration:3.343 }, - // Disable vbr.mp3 to see if it reduces the error of AUDCLNT_E_CPUUSAGE_EXCEEDED. - // See bug 1110922 comment 26. - //{ name:"vbr.mp3", type:"audio/mpeg", duration:10.0 }, -@@ -237,13 +237,13 @@ var gPlayTests = [ - - { name:"small-shot.m4a", type:"audio/mp4", duration:0.29 }, - { name:"small-shot.mp3", type:"audio/mpeg", duration:0.27 }, -- { name:"owl.mp3", type:"audio/mpeg", duration:3.29 }, -+ { name:"owl.mp3", type:"audio/mpeg", duration:3.343 }, - // owl.mp3 as above, but with something funny going on in the ID3v2 tag - // that causes DirectShow to fail. -- { name:"owl-funny-id3.mp3", type:"audio/mpeg", duration:3.29 }, -+ { name:"owl-funny-id3.mp3", type:"audio/mpeg", duration:3.343 }, - // owl.mp3 as above, but with something even funnier going on in the ID3v2 tag - // that causes DirectShow to fail. -- { name:"owl-funnier-id3.mp3", type:"audio/mpeg", duration:3.29 }, -+ { name:"owl-funnier-id3.mp3", type:"audio/mpeg", duration:3.343 }, - // One second of silence with ~140KB of ID3 tags. Usually when the first MP3 - // frame is at such a high offset into the file, MP3FrameParser will give up - // and report that the stream is not MP3. However, it does not count ID3 tags -@@ -469,7 +469,7 @@ var gSeekTests = [ - { name:"split.webm", type:"video/webm", duration:1.967 }, - { name:"detodos.opus", type:"audio/ogg; codecs=opus", duration:2.9135 }, - { name:"gizmo.mp4", type:"video/mp4", duration:5.56 }, -- { name:"owl.mp3", type:"audio/mpeg", duration:3.29 }, -+ { name:"owl.mp3", type:"audio/mpeg", duration:3.343 }, - { name:"bogus.duh", type:"bogus/duh", duration:123 } - ]; - -@@ -523,7 +523,7 @@ if (getAndroidVersion() >= 18) { - var gAudioTests = [ - { name:"r11025_s16_c1.wav", type:"audio/x-wav", duration:1.0 }, - { name:"sound.ogg", type:"audio/ogg" }, -- { name:"owl.mp3", type:"audio/mpeg", duration:3.29 }, -+ { name:"owl.mp3", type:"audio/mpeg", duration:3.343 }, - { name:"small-shot.m4a", type:"audio/mp4", duration:0.29 }, - { name:"bogus.duh", type:"bogus/duh", duration:123 } - ]; |