summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2018-10-20 08:24:28 -0500
committertrav90 <travawine@palemoon.org>2018-10-20 08:24:28 -0500
commit87adca8199155478c4e50b8a64546b9712e93ddd (patch)
tree4025c6a417a5dee99ceafb8b4aa6e9863dfa24f6
parenta94ca34235f14f553b333db2a22c2f6a0ece6254 (diff)
downloaduxp-87adca8199155478c4e50b8a64546b9712e93ddd.tar.gz
Put AV1 codec behind a pref
Disabled by default.
-rw-r--r--dom/media/MediaPrefs.h3
-rw-r--r--dom/media/platforms/agnostic/AgnosticDecoderModule.cpp8
-rw-r--r--dom/media/webm/WebMDecoder.cpp4
-rw-r--r--modules/libpref/init/all.js4
4 files changed, 16 insertions, 3 deletions
diff --git a/dom/media/MediaPrefs.h b/dom/media/MediaPrefs.h
index b237ecd3de..e67796eddb 100644
--- a/dom/media/MediaPrefs.h
+++ b/dom/media/MediaPrefs.h
@@ -120,6 +120,9 @@ private:
#ifdef MOZ_FFVPX
DECL_MEDIA_PREF("media.ffvpx.enabled", PDMFFVPXEnabled, bool, true);
#endif
+#ifdef MOZ_AV1
+ DECL_MEDIA_PREF("media.av1.enabled", AV1Enabled, bool, false);
+#endif
#ifdef XP_WIN
DECL_MEDIA_PREF("media.wmf.enabled", PDMWMFEnabled, bool, true);
DECL_MEDIA_PREF("media.wmf.skip-blacklist", PDMWMFSkipBlacklist, bool, false);
diff --git a/dom/media/platforms/agnostic/AgnosticDecoderModule.cpp b/dom/media/platforms/agnostic/AgnosticDecoderModule.cpp
index 4d4a90bd44..51ca4e9dee 100644
--- a/dom/media/platforms/agnostic/AgnosticDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/AgnosticDecoderModule.cpp
@@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "AgnosticDecoderModule.h"
+#include "MediaPrefs.h"
#include "mozilla/Logging.h"
#include "OpusDecoder.h"
#include "VorbisDecoder.h"
@@ -25,7 +26,9 @@ AgnosticDecoderModule::SupportsMimeType(const nsACString& aMimeType,
bool supports =
VPXDecoder::IsVPX(aMimeType) ||
#ifdef MOZ_AV1
- AOMDecoder::IsAV1(aMimeType) ||
+ if (MediaPrefs::AV1Enabled()) {
+ supports |= AOMDecoder::IsAV1(aMimeType);
+ }
#endif
OpusDataDecoder::IsOpus(aMimeType) ||
VorbisDataDecoder::IsVorbis(aMimeType) ||
@@ -45,7 +48,8 @@ AgnosticDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams)
m = new VPXDecoder(aParams);
}
#ifdef MOZ_AV1
- else if (AOMDecoder::IsAV1(aParams.mConfig.mMimeType)) {
+ else if (AOMDecoder::IsAV1(aParams.mConfig.mMimeType) &&
+ MediaPrefs::AV1Enabled()) {
m = new AOMDecoder(aParams);
}
#endif
diff --git a/dom/media/webm/WebMDecoder.cpp b/dom/media/webm/WebMDecoder.cpp
index 32feda6c04..5a32793ac0 100644
--- a/dom/media/webm/WebMDecoder.cpp
+++ b/dom/media/webm/WebMDecoder.cpp
@@ -8,6 +8,7 @@
#ifdef MOZ_AV1
#include "AOMDecoder.h"
#endif
+#include "MediaPrefs.h"
#include "MediaDecoderStateMachine.h"
#include "WebMDemuxer.h"
#include "WebMDecoder.h"
@@ -69,7 +70,8 @@ WebMDecoder::CanHandleMediaType(const nsACString& aMIMETypeExcludingCodecs,
continue;
}
#ifdef MOZ_AV1
- if (isWebMVideo && AOMDecoder::IsSupportedCodec(codec)) {
+ if (isWebMVideo && MediaPrefs::AV1Enabled() &&
+ AOMDecoder::IsSupportedCodec(codec)) {
continue;
}
#endif
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index 973edf6a50..f7bef942f4 100644
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -585,6 +585,10 @@ pref("media.mediasource.webm.enabled", true);
#endif
pref("media.mediasource.webm.audio.enabled", true);
+#ifdef MOZ_AV1
+pref("media.av1.enabled", false);
+#endif
+
// Use new MediaFormatReader architecture for plain ogg.
pref("media.flac.enabled", true);
pref("media.ogg.flac.enabled", true);