Date: Tue, 29 Dec 2015 07:53:56 +0000 (UTC) From: Jan Beich <jbeich@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r404717 - in head/www/firefox: . files Message-ID: <201512290753.tBT7rulI036422@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jbeich Date: Tue Dec 29 07:53:56 2015 New Revision: 404717 URL: https://svnweb.freebsd.org/changeset/ports/404717 Log: www/firefox: restore MP3 detection after r404688 Add upstream patch from Firefox 44 to make FFMPEG advertise MP3 support via canPlayType(). Otherwise, some sites may fall back to Flash plugin. Reported by: Walter Schwarzenfeld (via private mail) Added: head/www/firefox/files/patch-bug1209410 (contents, props changed) Modified: head/www/firefox/Makefile (contents, props changed) Modified: head/www/firefox/Makefile ============================================================================== --- head/www/firefox/Makefile Tue Dec 29 06:28:03 2015 (r404716) +++ head/www/firefox/Makefile Tue Dec 29 07:53:56 2015 (r404717) @@ -4,6 +4,7 @@ PORTNAME= firefox DISTVERSION= 43.0.3 DISTVERSIONSUFFIX=.source +PORTREVISION= 1 PORTEPOCH= 1 CATEGORIES= www ipv6 MASTER_SITES= MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \ Added: head/www/firefox/files/patch-bug1209410 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/firefox/files/patch-bug1209410 Tue Dec 29 07:53:56 2015 (r404717) @@ -0,0 +1,169 @@ +# Use MP3Demuxer/MediaFormatReader by default when available + +diff --git a/dom/media/DecoderTraits.cpp b/dom/media/DecoderTraits.cpp +--- dom/media/DecoderTraits.cpp ++++ 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 +--- dom/media/MP3Decoder.cpp ++++ 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 +--- dom/media/MP3Decoder.h ++++ 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 +--- dom/media/test/manifest.js ++++ 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 } + ];
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512290753.tBT7rulI036422>