Bug 1448222 - Remove MediaPrefs. r=jya
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 20 Mar 2018 09:48:56 +1100
changeset 467531 ba5089a967b993f911896e1f787fb9c7c9b406c3
parent 467530 529b9c25a0c2497dd6721f0794481eeb06be5173
child 467532 f94b64e0020225c71701930f193bd96c3ad1d150
child 467599 6cc3fb847d2f3b90dc6598eb4fae9bd2a36f7d1f
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1448222
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1448222 - Remove MediaPrefs. r=jya This patch converts all the prefs in MediaPrefs to the new StaticPrefs system. Note that the "media.wmf.skip-blacklist" pref was present in both MediaPrefs and gfxPrefs. The copy in MediaPrefs was never used; this explains why this patch does not add an entry for it to StaticPrefList.h. Note also that the patch removes themedia.rust.mp4parser pref, because it's unused. MozReview-Commit-ID: IfHP37NbIjY
browser/app/profile/firefox.js
dom/html/HTMLMediaElement.cpp
dom/html/HTMLVideoElement.h
dom/media/BackgroundVideoDecodingPermissionObserver.cpp
dom/media/Benchmark.cpp
dom/media/ChannelMediaDecoder.cpp
dom/media/DecoderTraits.cpp
dom/media/FileBlockCache.cpp
dom/media/MediaCache.cpp
dom/media/MediaDecoderStateMachine.cpp
dom/media/MediaFormatReader.cpp
dom/media/MediaFormatReader.h
dom/media/MediaPrefs.cpp
dom/media/MediaPrefs.h
dom/media/MediaResource.cpp
dom/media/MemoryBlockCache.cpp
dom/media/VideoUtils.cpp
dom/media/eme/MediaKeySystemAccess.cpp
dom/media/eme/MediaKeySystemAccessManager.cpp
dom/media/eme/mediadrm/MediaDrmProxySupport.cpp
dom/media/flac/FlacDecoder.cpp
dom/media/gmp/ChromiumCDMParent.cpp
dom/media/gmp/GMPParent.cpp
dom/media/gmp/GMPServiceParent.cpp
dom/media/gtest/TestGMPCrossOrigin.cpp
dom/media/gtest/TestGMPRemoveAndDelete.cpp
dom/media/gtest/TestGMPUtils.cpp
dom/media/gtest/mp4_demuxer/TestParser.cpp
dom/media/hls/HLSDecoder.cpp
dom/media/ipc/RemoteVideoDecoder.cpp
dom/media/ipc/VideoDecoderManagerChild.cpp
dom/media/mediasink/AudioSink.cpp
dom/media/mediasink/VideoSink.cpp
dom/media/mediasource/TrackBuffersManager.cpp
dom/media/moz.build
dom/media/mp4/MP4Decoder.cpp
dom/media/mp4/MP4Demuxer.cpp
dom/media/mp4/MP4Metadata.cpp
dom/media/ogg/OggDecoder.cpp
dom/media/ogg/OggDemuxer.cpp
dom/media/platforms/PDMFactory.cpp
dom/media/platforms/agnostic/AgnosticDecoderModule.cpp
dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp
dom/media/platforms/android/AndroidDecoderModule.cpp
dom/media/platforms/apple/AppleDecoderModule.cpp
dom/media/platforms/ffmpeg/FFmpegDecoderModule.h
dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
dom/media/platforms/wmf/WMFDecoderModule.cpp
dom/media/platforms/wrappers/H264Converter.cpp
dom/media/webm/WebMDecoder.cpp
dom/media/webspeech/recognition/SpeechRecognition.cpp
dom/media/webspeech/recognition/test/FakeSpeechRecognitionService.cpp
dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp
gfx/ipc/GPUProcessManager.cpp
gfx/thebes/gfxPlatform.cpp
layout/build/nsLayoutStatics.cpp
media/webrtc/signaling/src/media-conduit/MediaCodecVideoCodec.cpp
media/webrtc/signaling/src/media-conduit/MediaDataDecoderCodec.cpp
mobile/android/app/mobile.js
modules/libpref/init/StaticPrefList.h
modules/libpref/init/all.js
widget/GfxInfoBase.cpp
widget/android/AndroidBridge.cpp
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1436,30 +1436,16 @@ pref("identity.fxaccounts.migrateToDevEd
 pref("identity.fxaccounts.migrateToDevEdition", false);
 #endif
 
 // On GTK, we now default to showing the menubar only when alt is pressed:
 #ifdef MOZ_WIDGET_GTK
 pref("ui.key.menuAccessKeyFocuses", true);
 #endif
 
-// Encrypted media extensions.
-#ifdef XP_LINUX
-// On Linux EME is visible but disabled by default. This is so that the
-// "Play DRM content" checkbox in the Firefox UI is unchecked by default.
-// DRM requires downloading and installing proprietary binaries, which
-// users on an open source operating systems didn't opt into. The first
-// time a site using EME is encountered, the user will be prompted to
-// enable DRM, whereupon the EME plugin binaries will be downloaded if
-// permission is granted.
-pref("media.eme.enabled", false);
-#else
-pref("media.eme.enabled", true);
-#endif
-
 #ifdef NIGHTLY_BUILD
 pref("media.eme.vp9-in-mp4.enabled", true);
 #else
 pref("media.eme.vp9-in-mp4.enabled", false);
 #endif
 
 pref("media.eme.hdcp-policy-check.enabled", false);
 
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -7,23 +7,24 @@
 #include "mozilla/dom/HTMLMediaElement.h"
 #include "mozilla/dom/HTMLMediaElementBinding.h"
 #include "mozilla/dom/HTMLSourceElement.h"
 #include "mozilla/dom/HTMLAudioElement.h"
 #include "mozilla/dom/HTMLVideoElement.h"
 #include "mozilla/dom/ElementInlines.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/ArrayUtils.h"
-#include "mozilla/NotNull.h"
-#include "mozilla/MathAlgorithms.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/dom/MediaEncryptedEvent.h"
 #include "mozilla/EMEUtils.h"
 #include "mozilla/EventDispatcher.h"
+#include "mozilla/NotNull.h"
+#include "mozilla/MathAlgorithms.h"
 #include "mozilla/Sprintf.h"
+#include "mozilla/StaticPrefs.h"
 
 #include "AutoplayPolicy.h"
 #include "base/basictypes.h"
 #include "TimeRanges.h"
 #include "nsGenericHTMLElement.h"
 #include "nsAttrValueInlines.h"
 #include "nsPresContext.h"
 #include "nsIClassOfService.h"
@@ -48,17 +49,16 @@
 
 #include "nsIScriptSecurityManager.h"
 #include "nsIXPConnect.h"
 #include "jsapi.h"
 
 #include "nsITimer.h"
 
 #include "MediaError.h"
-#include "MediaPrefs.h"
 #include "MediaResource.h"
 
 #include "nsICategoryManager.h"
 #include "nsIContentPolicy.h"
 #include "nsContentPolicyUtils.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsICachingChannel.h"
 #include "nsLayoutUtils.h"
@@ -4460,17 +4460,18 @@ void HTMLMediaElement::HiddenVideoStart(
   MOZ_ASSERT(NS_IsMainThread());
   mHiddenPlayTime.Start();
   if (mVideoDecodeSuspendTimer) {
     // Already started, just keep it running.
     return;
   }
   NS_NewTimerWithFuncCallback(getter_AddRefs(mVideoDecodeSuspendTimer),
                               VideoDecodeSuspendTimerCallback, this,
-                              MediaPrefs::MDSMSuspendBackgroundVideoDelay(), nsITimer::TYPE_ONE_SHOT,
+                              StaticPrefs::MediaSuspendBkgndVideoDelayMs(),
+                              nsITimer::TYPE_ONE_SHOT,
                               "HTMLMediaElement::VideoDecodeSuspendTimerCallback",
                               mMainThreadEventTarget);
 }
 
 void HTMLMediaElement::HiddenVideoStop()
 {
   MOZ_ASSERT(NS_IsMainThread());
   mHiddenPlayTime.Pause();
@@ -4632,17 +4633,18 @@ HTMLMediaElement::ReportTelemetry()
                               NS_LITERAL_CSTRING("All"),
                               max_ms);
         LOG(LogLevel::Debug, ("%p VIDEO_INTER_KEYFRAME_MAX_MS = %u, keys: '%s' and 'All'",
                               this, max_ms, key.get()));
       } else {
         // Here, we have played *some* of the video, but didn't get more than 1
         // keyframe. Report '0' if we have played for longer than the video-
         // decode-suspend delay (showing recovery would be difficult).
-        uint32_t suspendDelay_ms = MediaPrefs::MDSMSuspendBackgroundVideoDelay();
+        uint32_t suspendDelay_ms =
+          StaticPrefs::MediaSuspendBkgndVideoDelayMs();
         if (uint32_t(playTime * 1000.0) > suspendDelay_ms) {
           Telemetry::Accumulate(Telemetry::VIDEO_INTER_KEYFRAME_MAX_MS,
                                 key,
                                 0);
           Telemetry::Accumulate(Telemetry::VIDEO_INTER_KEYFRAME_MAX_MS,
                                 NS_LITERAL_CSTRING("All"),
                                 0);
           LOG(LogLevel::Debug, ("%p VIDEO_INTER_KEYFRAME_MAX_MS = 0 (only 1 keyframe), keys: '%s' and 'All'",
--- a/dom/html/HTMLVideoElement.h
+++ b/dom/html/HTMLVideoElement.h
@@ -4,17 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_HTMLVideoElement_h
 #define mozilla_dom_HTMLVideoElement_h
 
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/HTMLMediaElement.h"
-#include "MediaPrefs.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 class FrameStatistics;
 
 namespace dom {
 
 class WakeLock;
@@ -133,17 +133,17 @@ public:
   // Gives access to the decoder's frame statistics, if present.
   FrameStatistics* GetFrameStatistics();
 
   already_AddRefed<VideoPlaybackQuality> GetVideoPlaybackQuality();
 
 
   bool MozOrientationLockEnabled() const
   {
-    return MediaPrefs::VideoOrientationLockEnabled();
+    return StaticPrefs::MediaVideocontrolsLockVideoOrientation();
   }
 
   bool MozIsOrientationLocked() const
   {
     return mIsOrientationLocked;
   }
 
   void SetMozIsOrientationLocked(bool aLock)
--- a/dom/media/BackgroundVideoDecodingPermissionObserver.cpp
+++ b/dom/media/BackgroundVideoDecodingPermissionObserver.cpp
@@ -1,18 +1,18 @@
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "BackgroundVideoDecodingPermissionObserver.h"
 
 #include "mozilla/AsyncEventDispatcher.h"
+#include "mozilla/StaticPrefs.h"
 #include "MediaDecoder.h"
-#include "MediaPrefs.h"
 #include "nsContentUtils.h"
 #include "nsIDocument.h"
 
 namespace mozilla {
 
 BackgroundVideoDecodingPermissionObserver::
   BackgroundVideoDecodingPermissionObserver(MediaDecoder* aDecoder)
   : mDecoder(aDecoder)
@@ -21,17 +21,17 @@ BackgroundVideoDecodingPermissionObserve
   MOZ_ASSERT(mDecoder);
 }
 
 NS_IMETHODIMP
 BackgroundVideoDecodingPermissionObserver::Observe(nsISupports* aSubject,
                                                    const char* aTopic,
                                                    const char16_t* aData)
 {
-  if (!MediaPrefs::ResumeVideoDecodingOnTabHover()) {
+  if (!StaticPrefs::MediaResumeBkgndVideoOnTabhover()) {
     return NS_OK;
   }
 
   if (!IsValidEventSender(aSubject)) {
     return NS_OK;
   }
 
   if (strcmp(aTopic, "unselected-tab-hover") == 0) {
--- a/dom/media/Benchmark.cpp
+++ b/dom/media/Benchmark.cpp
@@ -3,17 +3,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "Benchmark.h"
 
 #include "BufferMediaResource.h"
 #include "MediaData.h"
-#include "MediaPrefs.h"
 #include "PDMFactory.h"
 #include "VideoUtils.h"
 #include "WebMDemuxer.h"
 #include "gfxPrefs.h"
 #include "mozilla/AbstractThread.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/SharedThreadPool.h"
 #include "mozilla/SystemGroup.h"
@@ -147,17 +146,16 @@ Benchmark::Dispose()
 }
 
 void
 Benchmark::Init()
 {
   MOZ_ASSERT(NS_IsMainThread());
   gfxVars::Initialize();
   gfxPrefs::GetSingleton();
-  MediaPrefs::GetSingleton();
 }
 
 BenchmarkPlayback::BenchmarkPlayback(Benchmark* aMainThreadState,
                                      MediaDataDemuxer* aDemuxer)
   : QueueObject(new TaskQueue(
       GetMediaThreadPool(MediaThreadType::PLAYBACK),
       "BenchmarkPlayback::QueueObject"))
   , mMainThreadState(aMainThreadState)
--- a/dom/media/ChannelMediaDecoder.cpp
+++ b/dom/media/ChannelMediaDecoder.cpp
@@ -5,16 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ChannelMediaDecoder.h"
 #include "DecoderTraits.h"
 #include "MediaDecoderStateMachine.h"
 #include "MediaFormatReader.h"
 #include "BaseMediaResource.h"
 #include "MediaShutdownManager.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 extern LazyLogModule gMediaDecoderLog;
 #define LOG(x, ...)                                                            \
   DDMOZ_LOG(gMediaDecoderLog, LogLevel::Debug, x, ##__VA_ARGS__)
 
 ChannelMediaDecoder::ResourceCallback::ResourceCallback(
@@ -528,17 +529,17 @@ ChannelMediaDecoder::ShouldThrottleDownl
   // We throttle the download if either the throttle override pref is set
   // (so that we can always throttle in Firefox on mobile) or if the download
   // is fast enough that there's no concern about playback being interrupted.
   MOZ_ASSERT(NS_IsMainThread());
   NS_ENSURE_TRUE(GetStateMachine(), false);
 
   int64_t length = aStats.mTotalBytes;
   if (length > 0 &&
-      length <= int64_t(MediaPrefs::MediaMemoryCacheMaxSize()) * 1024) {
+      length <= int64_t(StaticPrefs::MediaMemoryCacheMaxSize()) * 1024) {
     // Don't throttle the download of small resources. This is to speed
     // up seeking, as seeks into unbuffered ranges would require starting
     // up a new HTTP transaction, which adds latency.
     return false;
   }
 
   if (Preferences::GetBool("media.throttle-regardless-of-download-rate",
                            false)) {
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -33,17 +33,16 @@
 
 #include "ADTSDecoder.h"
 #include "ADTSDemuxer.h"
 
 #include "FlacDecoder.h"
 #include "FlacDemuxer.h"
 
 #include "nsPluginHost.h"
-#include "MediaPrefs.h"
 
 namespace mozilla
 {
 
 /* static */ bool
 DecoderTraits::IsHttpLiveStreamingType(const MediaContainerType& aType)
 {
   const auto& mimeType = aType.Type();
--- a/dom/media/FileBlockCache.cpp
+++ b/dom/media/FileBlockCache.cpp
@@ -1,23 +1,23 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "FileBlockCache.h"
 #include "MediaCache.h"
-#include "MediaPrefs.h"
 #include "VideoUtils.h"
 #include "prio.h"
 #include <algorithm>
 #include "nsAnonymousTemporaryFile.h"
 #include "nsIThreadManager.h"
 #include "mozilla/dom/ContentChild.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/SystemGroup.h"
 #include "nsXULAppAPI.h"
 
 namespace mozilla {
 
 #undef LOG
 LazyLogModule gFileBlockCacheLog("FileBlockCache");
 #define LOG(x, ...) MOZ_LOG(gFileBlockCacheLog, LogLevel::Debug, \
@@ -135,17 +135,17 @@ FileBlockCache::Flush()
 }
 
 int32_t
 FileBlockCache::GetMaxBlocks() const
 {
   // We look up the cache size every time. This means dynamic changes
   // to the pref are applied.
   const uint32_t cacheSizeKb =
-    std::min(MediaPrefs::MediaCacheSizeKb(), uint32_t(INT32_MAX) * 2);
+    std::min(StaticPrefs::MediaCacheSize(), uint32_t(INT32_MAX) * 2);
   // Ensure we can divide BLOCK_SIZE by 1024.
   static_assert(MediaCacheStream::BLOCK_SIZE % 1024 == 0,
                 "BLOCK_SIZE should be a multiple of 1024");
   // Ensure BLOCK_SIZE/1024 is at least 2.
   static_assert(MediaCacheStream::BLOCK_SIZE / 1024 >= 2,
                 "BLOCK_SIZE / 1024 should be at least 2");
   // Ensure we can convert BLOCK_SIZE/1024 to a uint32_t without truncation.
   static_assert(MediaCacheStream::BLOCK_SIZE / 1024 <= int64_t(UINT32_MAX),
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -4,27 +4,27 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MediaCache.h"
 
 #include "ChannelMediaResource.h"
 #include "FileBlockCache.h"
 #include "MediaBlockCacheBase.h"
-#include "MediaPrefs.h"
 #include "MediaResource.h"
 #include "MemoryBlockCache.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/ErrorNames.h"
 #include "mozilla/Logging.h"
 #include "mozilla/Monitor.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
 #include "mozilla/StaticPtr.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/SystemGroup.h"
 #include "mozilla/Telemetry.h"
 #include "nsContentUtils.h"
 #include "nsIObserverService.h"
 #include "nsIPrincipal.h"
 #include "nsPrintfCString.h"
 #include "nsProxyRelease.h"
 #include "nsThreadUtils.h"
@@ -779,17 +779,17 @@ MediaCache::GetMediaCache(int64_t aConte
     ClearOnShutdown(&sClearThread, ShutdownPhase::ShutdownThreads);
   }
 
   if (!sThread) {
     return nullptr;
   }
 
   if (aContentLength > 0 &&
-      aContentLength <= int64_t(MediaPrefs::MediaMemoryCacheMaxSize()) * 1024) {
+      aContentLength <= int64_t(StaticPrefs::MediaMemoryCacheMaxSize()) * 1024) {
     // Small-enough resource, use a new memory-backed MediaCache.
     RefPtr<MediaBlockCacheBase> bc = new MemoryBlockCache(aContentLength);
     nsresult rv = bc->Init();
     if (NS_SUCCEEDED(rv)) {
       RefPtr<MediaCache> mc = new MediaCache(bc);
       LOG("GetMediaCache(%" PRIi64 ") -> Memory MediaCache %p",
           aContentLength,
           mc.get());
@@ -1371,18 +1371,18 @@ MediaCache::Update()
   TimeDuration latestNextUse;
   if (freeBlockCount == 0) {
     int32_t reusableBlock = FindReusableBlock(lock, now, nullptr, 0, maxBlocks);
     if (reusableBlock >= 0) {
       latestNextUse = PredictNextUse(lock, now, reusableBlock);
     }
   }
 
-  int32_t resumeThreshold = MediaPrefs::MediaCacheResumeThreshold();
-  int32_t readaheadLimit = MediaPrefs::MediaCacheReadaheadLimit();
+  int32_t resumeThreshold = StaticPrefs::MediaCacheResumeThreshold();
+  int32_t readaheadLimit = StaticPrefs::MediaCacheReadaheadLimit();
 
   for (uint32_t i = 0; i < mStreams.Length(); ++i) {
     actions.AppendElement(StreamAction{});
 
     MediaCacheStream* stream = mStreams[i];
     if (stream->mClosed) {
       LOG("Stream %p closed", stream);
       continue;
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -13,27 +13,27 @@
 #include "mediasink/DecodedStream.h"
 #include "mediasink/OutputStreamManager.h"
 #include "mediasink/VideoSink.h"
 #include "mozilla/Logging.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/NotNull.h"
 #include "mozilla/SharedThreadPool.h"
 #include "mozilla/Sprintf.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/TaskQueue.h"
 #include "mozilla/Tuple.h"
 #include "nsIMemoryReporter.h"
 #include "nsPrintfCString.h"
 #include "nsTArray.h"
 #include "ImageContainer.h"
 #include "MediaDecoder.h"
 #include "MediaDecoderStateMachine.h"
 #include "MediaShutdownManager.h"
-#include "MediaPrefs.h"
 #include "MediaTimer.h"
 #include "ReaderProxy.h"
 #include "TimeUnits.h"
 #include "VideoUtils.h"
 
 namespace mozilla {
 
 using namespace mozilla::media;
@@ -154,17 +154,17 @@ static void InitVideoQueuePrefs()
 }
 
 // Delay, in milliseconds, that tabs needs to be in background before video
 // decoding is suspended.
 static TimeDuration
 SuspendBackgroundVideoDelay()
 {
   return TimeDuration::FromMilliseconds(
-    MediaPrefs::MDSMSuspendBackgroundVideoDelay());
+    StaticPrefs::MediaSuspendBkgndVideoDelayMs());
 }
 
 class MediaDecoderStateMachine::StateObject
 {
 public:
   virtual ~StateObject() { }
   virtual void Exit() { }   // Exit action.
   virtual void Step() { }   // Perform a 'cycle' of this state object.
@@ -755,17 +755,17 @@ private:
   void StartDormantTimer()
   {
     if (!mMaster->mMediaSeekable) {
       // Don't enter dormant if the media is not seekable because we need to
       // seek when exiting dormant.
       return;
     }
 
-    auto timeout = MediaPrefs::DormantOnPauseTimeout();
+    auto timeout = StaticPrefs::MediaDormantOnPauseTimeoutMs();
     if (timeout < 0) {
       // Disabled when timeout is negative.
       return;
     } else if (timeout == 0) {
       // Enter dormant immediately without scheduling a timer.
       SetState<DormantState>();
       return;
     }
@@ -2198,17 +2198,17 @@ DecodeMetadataState::OnMetadataRead(Meta
 
   mMaster->mMetadataLoadedEvent.Notify(
     Move(aMetadata.mInfo),
     Move(aMetadata.mTags),
     MediaDecoderEventVisibility::Observable);
 
   // Check whether the media satisfies the requirement of seamless looing.
   // (Before checking the media is audio only, we need to get metadata first.)
-  mMaster->mSeamlessLoopingAllowed = MediaPrefs::SeamlessLooping() &&
+  mMaster->mSeamlessLoopingAllowed = StaticPrefs::MediaSeamlessLooping() &&
                                      mMaster->HasAudio() &&
                                      !mMaster->HasVideo();
   mMaster->LoopingChanged();
 
   SetState<DecodingFirstFrameState>();
 }
 
 void
@@ -3047,17 +3047,17 @@ void MediaDecoderStateMachine::SetVideoD
   MOZ_ASSERT(OnTaskQueue());
 
   LOG("SetVideoDecodeModeInternal(), VideoDecodeMode=(%s->%s), mVideoDecodeSuspended=%c",
       mVideoDecodeMode == VideoDecodeMode::Normal ? "Normal" : "Suspend",
       aMode == VideoDecodeMode::Normal ? "Normal" : "Suspend",
       mVideoDecodeSuspended ? 'T' : 'F');
 
   // Should not suspend decoding if we don't turn on the pref.
-  if (!MediaPrefs::MDSMSuspendBackgroundVideoEnabled() &&
+  if (!StaticPrefs::MediaSuspendBkgndVideoEnabled() &&
       aMode == VideoDecodeMode::Suspend) {
     LOG("SetVideoDecodeModeInternal(), early return because preference off and set to Suspend");
     return;
   }
 
   if (aMode == mVideoDecodeMode) {
     LOG("SetVideoDecodeModeInternal(), early return because the mode does not change");
     return;
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -12,20 +12,24 @@
 #include "VideoFrameContainer.h"
 #include "VideoUtils.h"
 #include "mozilla/AbstractThread.h"
 #include "mozilla/CDMProxy.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/NotNull.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/SharedThreadPool.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/Unused.h"
 #include "nsContentUtils.h"
 #include "nsPrintfCString.h"
+#ifdef MOZ_WIDGET_ANDROID
+#include "mozilla/jni/Utils.h"
+#endif
 
 #include <algorithm>
 #include <map>
 #include <queue>
 
 using namespace mozilla::media;
 
 static mozilla::LazyLogModule sFormatDecoderLog("MediaFormatReader");
@@ -1300,18 +1304,20 @@ MediaFormatReader::DemuxerProxy::NotifyD
   });
 }
 
 MediaFormatReader::MediaFormatReader(MediaFormatReaderInit& aInit,
                                      MediaDataDemuxer* aDemuxer)
   : mTaskQueue(new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK),
                              "MediaFormatReader::mTaskQueue",
                              /* aSupportsTailDispatch = */ true))
-  , mAudio(this, MediaData::AUDIO_DATA, MediaPrefs::MaxAudioDecodeError())
-  , mVideo(this, MediaData::VIDEO_DATA, MediaPrefs::MaxVideoDecodeError())
+  , mAudio(this, MediaData::AUDIO_DATA,
+           StaticPrefs::MediaAudioMaxDecodeError())
+  , mVideo(this, MediaData::VIDEO_DATA,
+           StaticPrefs::MediaVideoMaxDecodeError())
   , mDemuxer(new DemuxerProxy(aDemuxer))
   , mDemuxerInitDone(false)
   , mPendingNotifyDataArrived(false)
   , mLastReportedNumDecodedFrames(0)
   , mPreviousDecodedKeyframeTime_us(sNoPreviousDecodedKeyframe)
   , mKnowsCompositor(aInit.mKnowsCompositor)
   , mInitDone(false)
   , mTrackDemuxersMayBlock(false)
@@ -1577,17 +1583,17 @@ MediaFormatReader::AsyncReadMetadata()
 }
 
 void
 MediaFormatReader::OnDemuxerInitDone(const MediaResult& aResult)
 {
   MOZ_ASSERT(OnTaskQueue());
   mDemuxerInitRequest.Complete();
 
-  if (NS_FAILED(aResult) && MediaPrefs::MediaWarningsAsErrors()) {
+  if (NS_FAILED(aResult) && StaticPrefs::MediaPlaybackWarningsAsErrors()) {
     mMetadataPromise.Reject(aResult, __func__);
     return;
   }
 
   mDemuxerInitDone = true;
 
   UniquePtr<MetadataTags> tags(MakeUnique<MetadataTags>());
 
@@ -1777,17 +1783,17 @@ MediaFormatReader::GetDecoderData(TrackT
   return mVideo;
 }
 
 bool
 MediaFormatReader::ShouldSkip(TimeUnit aTimeThreshold)
 {
   MOZ_ASSERT(HasVideo());
 
-  if (!MediaPrefs::MFRSkipToNextKeyFrameEnabled()) {
+  if (!StaticPrefs::MediaDecoderSkipToNextKeyFrameEnabled()) {
     return false;
   }
 
   TimeUnit nextKeyframe;
   nsresult rv = mVideo.mTrackDemuxer->GetNextRandomAccessPoint(&nextKeyframe);
   if (NS_FAILED(rv)) {
     // Only OggTrackDemuxer with video type gets into here.
     // We don't support skip-to-next-frame for this case.
@@ -2398,17 +2404,17 @@ MediaFormatReader::HandleDemuxedSamples(
   }
 
   RefPtr<MediaRawData> sample = decoder.mQueuedSamples[0];
   const RefPtr<TrackInfoSharedPtr> info = sample->mTrackInfo;
 
   if (info && decoder.mLastStreamSourceID != info->GetID()) {
     nsTArray<RefPtr<MediaRawData>> samples;
     if (decoder.mDecoder) {
-      bool recyclable = MediaPrefs::MediaDecoderCheckRecycling() &&
+      bool recyclable = StaticPrefs::MediaDecoderRecycleEnabled() &&
                         decoder.mDecoder->SupportDecoderRecycling();
       if (!recyclable && decoder.mTimeThreshold.isNothing() &&
           (decoder.mNextStreamSourceID.isNothing() ||
             decoder.mNextStreamSourceID.ref() != info->GetID())) {
         LOG("%s stream id has changed from:%d to:%d, draining decoder.",
             TrackTypeToStr(aTrack),
             decoder.mLastStreamSourceID,
             info->GetID());
--- a/dom/media/MediaFormatReader.h
+++ b/dom/media/MediaFormatReader.h
@@ -4,25 +4,25 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #if !defined(MediaFormatReader_h_)
 #define MediaFormatReader_h_
 
 #include "mozilla/Atomics.h"
 #include "mozilla/Maybe.h"
+#include "mozilla/Mutex.h"
 #include "mozilla/StateMirroring.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/TaskQueue.h"
-#include "mozilla/Mutex.h"
 
 #include "FrameStatistics.h"
 #include "MediaEventSource.h"
 #include "MediaDataDemuxer.h"
 #include "MediaMetadataManager.h"
-#include "MediaPrefs.h"
 #include "MediaPromiseDefs.h"
 #include "nsAutoPtr.h"
 #include "PDMFactory.h"
 #include "SeekTarget.h"
 
 namespace mozilla {
 
 class CDMProxy;
@@ -482,17 +482,17 @@ private:
     {
       if (!mError.isSome()) {
         return false;
       }
       if (mError.ref() == NS_ERROR_DOM_MEDIA_DECODE_ERR) {
         // Allow decode errors to be non-fatal, but give up
         // if we have too many, or if warnings should be treated as errors.
         return mNumOfConsecutiveError > mMaxConsecutiveError ||
-               MediaPrefs::MediaWarningsAsErrors();
+               StaticPrefs::MediaPlaybackWarningsAsErrors();
       } else if (mError.ref() == NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER) {
         // If the caller asked for a new decoder we shouldn't treat
         // it as fatal.
         return false;
       } else {
         // All other error types are fatal
         return true;
       }
deleted file mode 100644
--- a/dom/media/MediaPrefs.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "MediaPrefs.h"
-
-#include "mozilla/ClearOnShutdown.h"
-#include "mozilla/Preferences.h"
-#include "mozilla/StaticPtr.h"
-#include "MainThreadUtils.h"
-
-namespace mozilla {
-
-StaticAutoPtr<MediaPrefs> MediaPrefs::sInstance;
-
-MediaPrefs&
-MediaPrefs::GetSingleton()
-{
-  if (!sInstance) {
-    sInstance = new MediaPrefs;
-    ClearOnShutdown(&sInstance);
-  }
-  MOZ_ASSERT(SingletonExists());
-  return *sInstance;
-}
-
-bool
-MediaPrefs::SingletonExists()
-{
-  return sInstance != nullptr;
-}
-
-MediaPrefs::MediaPrefs()
-{
-  MediaPrefs::AssertMainThread();
-}
-
-void MediaPrefs::AssertMainThread()
-{
-  MOZ_ASSERT(NS_IsMainThread(), "this code must be run on the main thread");
-}
-
-void MediaPrefs::PrefAddVarCache(bool* aVariable,
-                                 const char* aPref,
-                                 bool aDefault)
-{
-  Preferences::AddBoolVarCache(aVariable, aPref, aDefault);
-}
-
-void MediaPrefs::PrefAddVarCache(int32_t* aVariable,
-                                 const char* aPref,
-                                 int32_t aDefault)
-{
-  Preferences::AddIntVarCache(aVariable, aPref, aDefault);
-}
-
-void MediaPrefs::PrefAddVarCache(uint32_t* aVariable,
-                                 const char* aPref,
-                                 uint32_t aDefault)
-{
-  Preferences::AddUintVarCache(aVariable, aPref, aDefault);
-}
-
-void MediaPrefs::PrefAddVarCache(float* aVariable,
-                                 const char* aPref,
-                                 float aDefault)
-{
-  Preferences::AddFloatVarCache(aVariable, aPref, aDefault);
-}
-
-void MediaPrefs::PrefAddVarCache(AtomicBool* aVariable,
-                                 const char* aPref,
-                                 bool aDefault)
-{
-  Preferences::AddAtomicBoolVarCache(aVariable, aPref, aDefault);
-}
-
-void MediaPrefs::PrefAddVarCache(AtomicInt32* aVariable,
-                                 const char* aPref,
-                                 int32_t aDefault)
-{
-  Preferences::AddAtomicIntVarCache(aVariable, aPref, aDefault);
-}
-
-void MediaPrefs::PrefAddVarCache(AtomicUint32* aVariable,
-                                 const char* aPref,
-                                 uint32_t aDefault)
-{
-  Preferences::AddAtomicUintVarCache(aVariable, aPref, aDefault);
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/dom/media/MediaPrefs.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef MEDIA_PREFS_H
-#define MEDIA_PREFS_H
-
-#ifdef MOZ_WIDGET_ANDROID
-#include "GeneratedJNIWrappers.h"
-#endif
-
-#include "mozilla/Atomics.h"
-
-// First time MediaPrefs::GetSingleton() needs to be called on the main thread,
-// before any of the methods accessing the values are used, but after
-// the Preferences system has been initialized.
-
-// The static methods to access the preference value are safe to call
-// from any thread after that first call.
-
-// To register a preference, you need to add a line in this file using
-// the DECL_MEDIA_PREF macro.
-//
-// For example this line in the .h:
-//   DECL_MEDIA_PREF("media.resampling.enabled",AudioSinkResampling,bool,false);
-// means that you can call
-//   const bool& var = MediaPrefs::AudioSinkResampling();
-// from any thread, you will get the most up to date preference value of
-// "media.resampling.enabled".  If the value is not set, the default would be
-// false.
-
-#define DECL_MEDIA_PREF(Pref, Name, Type, Default)                            \
-public:                                                                       \
-static const Type& Name() { MOZ_ASSERT(SingletonExists()); return GetSingleton().mPref##Name.mValue; } \
-private:                                                                      \
-static const char* Get##Name##PrefName() { return Pref; }                     \
-static StripAtomic<Type> Get##Name##PrefDefault() { return Default; }         \
-PrefTemplate<Type, Get##Name##PrefDefault, Get##Name##PrefName> mPref##Name
-
-// Custom Definitions.
-#define GMP_DEFAULT_ASYNC_SHUTDOWN_TIMEOUT 3000
-#define SUSPEND_BACKGROUND_VIDEO_DELAY_MS 10000
-#define TEST_PREFERENCE_FAKE_RECOGNITION_SERVICE "media.webspeech.test.fake_recognition_service"
-
-namespace mozilla {
-
-template<class T> class StaticAutoPtr;
-
-class MediaPrefs final
-{
-  typedef Atomic<bool, Relaxed> AtomicBool;
-  typedef Atomic<int32_t, Relaxed> AtomicInt32;
-  typedef Atomic<uint32_t, Relaxed> AtomicUint32;
-
-  template <typename T>
-  struct StripAtomicImpl {
-    typedef T Type;
-  };
-
-  template <typename T, MemoryOrdering Order>
-  struct StripAtomicImpl<Atomic<T, Order>> {
-    typedef T Type;
-  };
-
-  template <typename T>
-  using StripAtomic = typename StripAtomicImpl<T>::Type;
-
-private:
-  // Since we cannot use const char*, use a function that returns it.
-  template <class T, StripAtomic<T> Default(), const char* Pref()>
-  class PrefTemplate
-  {
-  public:
-    PrefTemplate()
-    : mValue(Default())
-    {
-      Register(Pref());
-    }
-    T mValue;
-  private:
-    void Register(const char* aPreference)
-    {
-      AssertMainThread();
-      PrefAddVarCache(&mValue, aPreference, mValue);
-    }
-  };
-
-  // This is where DECL_MEDIA_PREF for each of the preferences should go.
-
-  // Cache sizes.
-  DECL_MEDIA_PREF("media.cache_size",                         MediaCacheSizeKb, uint32_t, 512000);
-  DECL_MEDIA_PREF("media.memory_cache_max_size",              MediaMemoryCacheMaxSize, uint32_t, 8192);
-  DECL_MEDIA_PREF("media.memory_caches_combined_limit_kb",    MediaMemoryCachesCombinedLimitKb, uint32_t, 524288);
-  DECL_MEDIA_PREF("media.memory_caches_combined_limit_pc_sysmem",
-                                                              MediaMemoryCachesCombinedLimitPcSysmem, uint32_t, 5);
-
-  DECL_MEDIA_PREF("media.cache_resume_threshold",             MediaCacheResumeThreshold, int32_t, 10);
-  DECL_MEDIA_PREF("media.cache_readahead_limit",              MediaCacheReadaheadLimit, int32_t, 30);
-
-  // AudioSink
-  DECL_MEDIA_PREF("accessibility.monoaudio.enable",           MonoAudio, bool, false);
-  DECL_MEDIA_PREF("media.resampling.enabled",                 AudioSinkResampling, bool, false);
-#if defined(XP_WIN) || defined(XP_DARWIN) || defined(MOZ_PULSEAUDIO)
-  DECL_MEDIA_PREF("media.forcestereo.enabled",                AudioSinkForceStereo, bool, false);
-#else
-  DECL_MEDIA_PREF("media.forcestereo.enabled",                AudioSinkForceStereo, bool, true);
-#endif
-  // VideoSink
-  DECL_MEDIA_PREF("media.ruin-av-sync.enabled",               RuinAvSync, bool, false);
-
-  // Encrypted Media Extensions
-  DECL_MEDIA_PREF("media.clearkey.persistent-license.enabled", ClearKeyPersistentLicenseEnabled, bool, false);
-
-  // PlatformDecoderModule
-  DECL_MEDIA_PREF("media.gmp.insecure.allow",                 GMPAllowInsecure, bool, false);
-  DECL_MEDIA_PREF("media.eme.enabled",                        EMEEnabled, bool, false);
-  DECL_MEDIA_PREF("media.use-blank-decoder",                  PDMUseBlankDecoder, bool, false);
-  DECL_MEDIA_PREF("media.gpu-process-decoder",                PDMUseGPUDecoder, bool, false);
-#ifdef MOZ_WIDGET_ANDROID
-  DECL_MEDIA_PREF("media.android-media-codec.enabled",        PDMAndroidMediaCodecEnabled, bool, false);
-  DECL_MEDIA_PREF("media.android-media-codec.preferred",      PDMAndroidMediaCodecPreferred, bool, false);
-  DECL_MEDIA_PREF("media.navigator.hardware.vp8_encode.acceleration_remote_enabled", RemoteMediaCodecVP8EncoderEnabled, bool, false);
-#endif
-  // WebRTC
-  DECL_MEDIA_PREF("media.navigator.mediadatadecoder_enabled", MediaDataDecoderEnabled, bool, false);
-#ifdef MOZ_FFMPEG
-  DECL_MEDIA_PREF("media.ffmpeg.enabled",                     PDMFFmpegEnabled, bool, true);
-  DECL_MEDIA_PREF("media.libavcodec.allow-obsolete",          LibavcodecAllowObsolete, bool, false);
-#endif
-#if defined(MOZ_FFMPEG) || defined(MOZ_FFVPX)
-  DECL_MEDIA_PREF("media.ffmpeg.low-latency.enabled",         PDMFFmpegLowLatencyEnabled, bool, false);
-#endif
-#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);
-  DECL_MEDIA_PREF("media.decoder-doctor.wmf-disabled-is-failure", DecoderDoctorWMFDisabledIsFailure, bool, false);
-  DECL_MEDIA_PREF("media.wmf.vp9.enabled",                    PDMWMFVP9DecoderEnabled, bool, true);
-#endif
-  DECL_MEDIA_PREF("media.decoder.recycle.enabled",            MediaDecoderCheckRecycling, bool, false);
-  DECL_MEDIA_PREF("media.decoder.skip-to-next-key-frame.enabled", MFRSkipToNextKeyFrameEnabled, bool, true);
-  DECL_MEDIA_PREF("media.gmp.decoder.enabled",                PDMGMPEnabled, bool, true);
-  DECL_MEDIA_PREF("media.eme.audio.blank",                    EMEBlankAudio, bool, false);
-  DECL_MEDIA_PREF("media.eme.video.blank",                    EMEBlankVideo, bool, false);
-  DECL_MEDIA_PREF("media.eme.chromium-api.video-shmems",
-                  EMEChromiumAPIVideoShmemCount,
-                  uint32_t,
-                  3);
-
-  // MediaDecoderStateMachine
-  DECL_MEDIA_PREF("media.suspend-bkgnd-video.enabled",        MDSMSuspendBackgroundVideoEnabled, bool, false);
-  DECL_MEDIA_PREF("media.suspend-bkgnd-video.delay-ms",       MDSMSuspendBackgroundVideoDelay, AtomicUint32, SUSPEND_BACKGROUND_VIDEO_DELAY_MS);
-  DECL_MEDIA_PREF("media.dormant-on-pause-timeout-ms",        DormantOnPauseTimeout, int32_t, 5000);
-
-  // WebSpeech
-  DECL_MEDIA_PREF("media.webspeech.synth.force_global_queue", WebSpeechForceGlobal, bool, false);
-  DECL_MEDIA_PREF("media.webspeech.test.enable",              WebSpeechTestEnabled, bool, false);
-  DECL_MEDIA_PREF("media.webspeech.test.fake_fsm_events",     WebSpeechFakeFSMEvents, bool, false);
-  DECL_MEDIA_PREF(TEST_PREFERENCE_FAKE_RECOGNITION_SERVICE,   WebSpeechFakeRecognitionService, bool, false);
-  DECL_MEDIA_PREF("media.webspeech.recognition.enable",       WebSpeechRecognitionEnabled, bool, false);
-  DECL_MEDIA_PREF("media.webspeech.recognition.force_enable", WebSpeechRecognitionForceEnabled, bool, false);
-
-#if defined(RELEASE_OR_BETA)
-  DECL_MEDIA_PREF("media.audio-max-decode-error",             MaxAudioDecodeError, uint32_t, 3);
-  DECL_MEDIA_PREF("media.video-max-decode-error",             MaxVideoDecodeError, uint32_t, 2);
-#else
-  // Take zero tolerance of decoding error in debug for any decoder regression.
-  DECL_MEDIA_PREF("media.audio-max-decode-error",             MaxAudioDecodeError, uint32_t, 0);
-  DECL_MEDIA_PREF("media.video-max-decode-error",             MaxVideoDecodeError, uint32_t, 0);
-#endif
-
-  // Ogg
-  DECL_MEDIA_PREF("media.ogg.enabled",                        OggEnabled, bool, true);
-  // Flac
-  DECL_MEDIA_PREF("media.ogg.flac.enabled",                   FlacInOgg, bool, false);
-  DECL_MEDIA_PREF("media.flac.enabled",                       FlacEnabled, bool, true);
-
-  // Hls
-  DECL_MEDIA_PREF("media.hls.enabled",                        HLSEnabled, bool, false);
-
-  // True, it enables rust parser and fallback to stagefright if rust parser fails.
-  // False, it uses stagefright only.
-  DECL_MEDIA_PREF("media.rust.mp4parser",                     EnableRustMP4Parser, bool, true);
-
-  DECL_MEDIA_PREF("media.mp4.enabled",                        MP4Enabled, bool, false);
-
-  // Error/warning handling, Decoder Doctor
-  DECL_MEDIA_PREF("media.playback.warnings-as-errors",        MediaWarningsAsErrors, bool, false);
-
-  // resume background video decoding when the cursor is hovering over the tab.
-  DECL_MEDIA_PREF("media.resume-bkgnd-video-on-tabhover",     ResumeVideoDecodingOnTabHover, bool, false);
-
-  DECL_MEDIA_PREF("media.videocontrols.lock-video-orientation",  VideoOrientationLockEnabled, bool, false);
-
-  // Media Seamless Looping
-  DECL_MEDIA_PREF("media.seamless-looping",                   SeamlessLooping, bool, true);
-
-public:
-  // Manage the singleton:
-  static MediaPrefs& GetSingleton();
-  static bool SingletonExists();
-
-private:
-  template<class T> friend class StaticAutoPtr;
-  static StaticAutoPtr<MediaPrefs> sInstance;
-
-  // Creating these to avoid having to include Preferences.h in the .h
-  static void PrefAddVarCache(bool*, const char*, bool);
-  static void PrefAddVarCache(int32_t*, const char*, int32_t);
-  static void PrefAddVarCache(uint32_t*, const char*, uint32_t);
-  static void PrefAddVarCache(float*, const char*, float);
-  static void PrefAddVarCache(AtomicBool*, const char*, bool);
-  static void PrefAddVarCache(AtomicInt32*, const char*, int32_t);
-  static void PrefAddVarCache(AtomicUint32*, const char*, uint32_t);
-
-  static void AssertMainThread();
-
-  MediaPrefs();
-  MediaPrefs(const MediaPrefs&) = delete;
-  MediaPrefs& operator=(const MediaPrefs&) = delete;
-};
-
-#undef DECL_MEDIA_PREF /* Don't need it outside of this file */
-
-} // namespace mozilla
-
-#endif /* MEDIA_PREFS_H */
--- a/dom/media/MediaResource.cpp
+++ b/dom/media/MediaResource.cpp
@@ -1,16 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MediaResource.h"
-#include "MediaPrefs.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/Logging.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/SystemGroup.h"
 #include "mozilla/ErrorNames.h"
 
 using mozilla::media::TimeUnit;
 
--- a/dom/media/MemoryBlockCache.cpp
+++ b/dom/media/MemoryBlockCache.cpp
@@ -1,22 +1,22 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MemoryBlockCache.h"
 
-#include "MediaPrefs.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/Logging.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/Services.h"
+#include "mozilla/StaticPrefs.h"
 #include "nsIObserver.h"
 #include "nsIObserverService.h"
 #include "nsWeakReference.h"
 #include "prsystem.h"
 
 namespace mozilla {
 
 #undef LOG
@@ -134,17 +134,17 @@ enum MemoryBlockCacheTelemetryErrors
   MoveBlockSourceOverrun = 5,
   MoveBlockDestOverflow = 6,
   MoveBlockCannotGrow = 7,
 };
 
 static int32_t
 CalculateMaxBlocks(int64_t aContentLength)
 {
-  int64_t maxSize = int64_t(MediaPrefs::MediaMemoryCacheMaxSize()) * 1024;
+  int64_t maxSize = int64_t(StaticPrefs::MediaMemoryCacheMaxSize()) * 1024;
   MOZ_ASSERT(aContentLength <= maxSize);
   MOZ_ASSERT(maxSize % MediaBlockCacheBase::BLOCK_SIZE == 0);
   // Note: It doesn't matter if calculations overflow, Init() would later fail.
   // We want at least enough blocks to contain the original content length.
   const int32_t requiredBlocks = maxSize / MediaBlockCacheBase::BLOCK_SIZE;
   // Allow at least 1s of ultra HD (25Mbps).
   const int32_t workableBlocks =
     25 * 1024 * 1024 / 8 / MediaBlockCacheBase::BLOCK_SIZE;
@@ -200,18 +200,18 @@ MemoryBlockCache::EnsureBufferCanContain
     // limit.
     // The alternative would have been to reserve the space first with
     // `atomic += extra` and then undo it with `atomic -= extra` in case of
     // failure; but this would have meant potentially preventing other (small
     // but successful) allocations.
     static const size_t sysmem =
       std::max<size_t>(PR_GetPhysicalMemorySize(), 32 * 1024 * 1024);
     const size_t limit = std::min(
-      size_t(MediaPrefs::MediaMemoryCachesCombinedLimitKb()) * 1024,
-      sysmem * MediaPrefs::MediaMemoryCachesCombinedLimitPcSysmem() / 100);
+      size_t(StaticPrefs::MediaMemoryCachesCombinedLimitKb()) * 1024,
+      sysmem * StaticPrefs::MediaMemoryCachesCombinedLimitPcSysmem() / 100);
     const size_t currentSizes = static_cast<size_t>(gCombinedSizes);
     if (currentSizes + extra > limit) {
       LOG("EnsureBufferCanContain(%zu) - buffer size %zu, wanted + %zu = %zu;"
           " combined sizes %zu + %zu > limit %zu",
           aContentLength,
           initialLength,
           extra,
           desiredLength,
--- a/dom/media/VideoUtils.cpp
+++ b/dom/media/VideoUtils.cpp
@@ -5,22 +5,22 @@
 #include "VideoUtils.h"
 
 #include <functional>
 #include <stdint.h>
 
 #include "CubebUtils.h"
 #include "ImageContainer.h"
 #include "MediaContainerType.h"
-#include "MediaPrefs.h"
 #include "MediaResource.h"
 #include "TimeUnits.h"
 #include "VorbisUtils.h"
 #include "mozilla/Base64.h"
 #include "mozilla/SharedThreadPool.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/SystemGroup.h"
 #include "mozilla/TaskCategory.h"
 #include "mozilla/TaskQueue.h"
 #include "mozilla/Telemetry.h"
 #include "nsCharSeparatedTokenizer.h"
 #include "nsContentTypeParser.h"
 #include "nsIConsoleService.h"
 #include "nsIRandomGenerator.h"
@@ -166,21 +166,21 @@ void DownmixStereoToMono(mozilla::AudioD
     sample = (aBuffer[fIdx*channels] + aBuffer[fIdx*channels + 1]) * 0.5;
     aBuffer[fIdx*channels] = aBuffer[fIdx*channels + 1] = sample;
   }
 }
 
 uint32_t
 DecideAudioPlaybackChannels(const AudioInfo& info)
 {
-  if (MediaPrefs::MonoAudio()) {
+  if (StaticPrefs::accessibility_monoaudio_enable()) {
     return 1;
   }
 
-  if (MediaPrefs::AudioSinkForceStereo()) {
+  if (StaticPrefs::MediaForcestereoEnabled()) {
     return 2;
   }
 
   return info.mChannels;
 }
 
 bool
 IsDefaultPlaybackDeviceMono()
--- a/dom/media/eme/MediaKeySystemAccess.cpp
+++ b/dom/media/eme/MediaKeySystemAccess.cpp
@@ -3,18 +3,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/MediaKeySystemAccess.h"
 #include "mozilla/dom/MediaKeySystemAccessBinding.h"
 #include "mozilla/dom/MediaKeySession.h"
 #include "mozilla/Preferences.h"
+#include "mozilla/StaticPrefs.h"
 #include "MediaContainerType.h"
-#include "MediaPrefs.h"
 #include "nsMimeTypes.h"
 #ifdef XP_WIN
 #include "WMFDecoderModule.h"
 #endif
 #include "nsContentCID.h"
 #include "nsServiceManagerUtils.h"
 #include "mozIGeckoMediaPluginService.h"
 #include "VideoUtils.h"
@@ -30,16 +30,17 @@
 #include "WebMDecoder.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "nsUnicharUtils.h"
 #include "mozilla/dom/MediaSource.h"
 #include "DecoderTraits.h"
 #ifdef MOZ_WIDGET_ANDROID
 #include "FennecJNIWrappers.h"
+#include "GeneratedJNIWrappers.h"
 #endif
 #include <functional>
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(MediaKeySystemAccess,
                                       mParent)
@@ -128,17 +129,18 @@ EnsureCDMInstalled(const nsAString& aKey
   return MediaKeySystemStatus::Available;
 }
 
 /* static */
 MediaKeySystemStatus
 MediaKeySystemAccess::GetKeySystemStatus(const nsAString& aKeySystem,
                                          nsACString& aOutMessage)
 {
-  MOZ_ASSERT(MediaPrefs::EMEEnabled() || IsClearkeyKeySystem(aKeySystem));
+  MOZ_ASSERT(StaticPrefs::MediaEmeEnabled() ||
+             IsClearkeyKeySystem(aKeySystem));
 
   if (IsClearkeyKeySystem(aKeySystem)) {
     return EnsureCDMInstalled(aKeySystem, aOutMessage);
   }
 
   if (IsWidevineKeySystem(aKeySystem)) {
     if (Preferences::GetBool("media.gmp-widevinecdm.visible", false)) {
       if (!Preferences::GetBool("media.gmp-widevinecdm.enabled", false)) {
@@ -270,17 +272,17 @@ GetSupportedKeySystems()
       KeySystemConfig clearkey;
       clearkey.mKeySystem = NS_ConvertUTF8toUTF16(kEMEKeySystemClearkey);
       clearkey.mInitDataTypes.AppendElement(NS_LITERAL_STRING("cenc"));
       clearkey.mInitDataTypes.AppendElement(NS_LITERAL_STRING("keyids"));
       clearkey.mInitDataTypes.AppendElement(NS_LITERAL_STRING("webm"));
       clearkey.mPersistentState = KeySystemFeatureSupport::Requestable;
       clearkey.mDistinctiveIdentifier = KeySystemFeatureSupport::Prohibited;
       clearkey.mSessionTypes.AppendElement(MediaKeySessionType::Temporary);
-      if (MediaPrefs::ClearKeyPersistentLicenseEnabled()) {
+      if (StaticPrefs::MediaClearkeyPersistentLicenseEnabled()) {
         clearkey.mSessionTypes.AppendElement(MediaKeySessionType::Persistent_license);
       }
 #if defined(XP_WIN)
       // Clearkey CDM uses WMF's H.264 decoder on Windows.
       if (WMFDecoderModule::HasH264()) {
         clearkey.mMP4.SetCanDecryptAndDecode(EME_CODEC_H264);
       } else {
         clearkey.mMP4.SetCanDecrypt(EME_CODEC_H264);
--- a/dom/media/eme/MediaKeySystemAccessManager.cpp
+++ b/dom/media/eme/MediaKeySystemAccessManager.cpp
@@ -1,20 +1,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MediaKeySystemAccessManager.h"
 #include "DecoderDoctorDiagnostics.h"
-#include "MediaPrefs.h"
 #include "mozilla/EMEUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIObserverService.h"
 #include "mozilla/Services.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/DetailedPromise.h"
 #ifdef XP_WIN
 #include "mozilla/WindowsVersion.h"
 #endif
 #ifdef XP_MACOSX
 #include "nsCocoaFeatures.h"
 #endif
 #include "nsPrintfCString.h"
@@ -103,17 +103,17 @@ MediaKeySystemAccessManager::Request(Det
     // supported.
     aPromise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR,
                           NS_LITERAL_CSTRING("Key system is unsupported"));
     diagnostics.StoreMediaKeySystemAccess(mWindow->GetExtantDoc(),
                                           aKeySystem, false, __func__);
     return;
   }
 
-  if (!MediaPrefs::EMEEnabled() && !IsClearkeyKeySystem(aKeySystem)) {
+  if (!StaticPrefs::MediaEmeEnabled() && !IsClearkeyKeySystem(aKeySystem)) {
     // EME disabled by user, send notification to chrome so UI can inform user.
     // Clearkey is allowed even when EME is disabled because we want the pref
     // "media.eme.enabled" only taking effect on proprietary DRMs.
     MediaKeySystemAccess::NotifyObservers(mWindow,
                                           aKeySystem,
                                           MediaKeySystemStatus::Api_disabled);
     aPromise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR,
                           NS_LITERAL_CSTRING("EME has been preffed off"));
--- a/dom/media/eme/mediadrm/MediaDrmProxySupport.cpp
+++ b/dom/media/eme/mediadrm/MediaDrmProxySupport.cpp
@@ -3,17 +3,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MediaDrmProxySupport.h"
 #include "mozilla/EMEUtils.h"
 #include "FennecJNINatives.h"
 #include "MediaCodec.h" // For MediaDrm::KeyStatus
-#include "MediaPrefs.h"
 
 using namespace mozilla::java;
 
 namespace mozilla {
 
 LogModule* GetMDRMNLog() {
   static LazyLogModule log("MediaDrmProxySupport");
   return log;
--- a/dom/media/flac/FlacDecoder.cpp
+++ b/dom/media/flac/FlacDecoder.cpp
@@ -1,25 +1,25 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "FlacDecoder.h"
 #include "MediaContainerType.h"
-#include "MediaPrefs.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 /* static */ bool
 FlacDecoder::IsEnabled()
 {
 #ifdef MOZ_FFVPX
-  return MediaPrefs::FlacEnabled();
+  return StaticPrefs::MediaFlacEnabled();
 #else
   // Until bug 1295886 is fixed.
   return false;
 #endif
 }
 
 /* static */ bool
 FlacDecoder::IsSupportedType(const MediaContainerType& aContainerType)
--- a/dom/media/gmp/ChromiumCDMParent.cpp
+++ b/dom/media/gmp/ChromiumCDMParent.cpp
@@ -9,35 +9,35 @@
 #include "ChromiumCDMCallbackProxy.h"
 #include "ChromiumCDMProxy.h"
 #include "content_decryption_module.h"
 #include "GMPContentChild.h"
 #include "GMPContentParent.h"
 #include "GMPLog.h"
 #include "GMPService.h"
 #include "GMPUtils.h"
-#include "MediaPrefs.h"
 #include "mozilla/dom/MediaKeyMessageEventBinding.h"
 #include "mozilla/gmp/GMPTypes.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Unused.h"
 #include "AnnexB.h"
 #include "H264.h"
 
 #define NS_DispatchToMainThread(...) CompileError_UseAbstractMainThreadInstead
 
 namespace mozilla {
 namespace gmp {
 
 using namespace eme;
 
 ChromiumCDMParent::ChromiumCDMParent(GMPContentParent* aContentParent,
                                      uint32_t aPluginId)
   : mPluginId(aPluginId)
   , mContentParent(aContentParent)
-  , mVideoShmemLimit(MediaPrefs::EMEChromiumAPIVideoShmemCount())
+  , mVideoShmemLimit(StaticPrefs::MediaEmeChromiumApiVideoShmems())
 {
   GMP_LOG(
     "ChromiumCDMParent::ChromiumCDMParent(this=%p, contentParent=%p, id=%u)",
     this,
     aContentParent,
     aPluginId);
 }
 
--- a/dom/media/gmp/GMPParent.cpp
+++ b/dom/media/gmp/GMPParent.cpp
@@ -21,17 +21,16 @@
 #include "nsIObserverService.h"
 #include "GMPTimerParent.h"
 #include "runnable_utils.h"
 #if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
 #include "mozilla/SandboxInfo.h"
 #endif
 #include "CDMStorageIdProvider.h"
 #include "GMPContentParent.h"
-#include "MediaPrefs.h"
 #include "VideoUtils.h"
 
 using mozilla::ipc::GeckoChildProcessHost;
 
 using CrashReporter::AnnotationTable;
 using CrashReporter::GetIDFromMinidump;
 
 #include "mozilla/Telemetry.h"
--- a/dom/media/gmp/GMPServiceParent.cpp
+++ b/dom/media/gmp/GMPServiceParent.cpp
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "GMPServiceParent.h"
 #include "GMPService.h"
 #include "prio.h"
 #include "base/task.h"
 #include "mozilla/AbstractThread.h"
 #include "mozilla/Logging.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/dom/ContentParent.h"
 #include "GMPParent.h"
 #include "GMPVideoDecoderParent.h"
 #include "nsAutoPtr.h"
 #include "nsIObserverService.h"
 #include "GeckoChildProcessHost.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ClearOnShutdown.h"
@@ -33,17 +34,16 @@
 #include "nsDirectoryServiceUtils.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsHashKeys.h"
 #include "nsIFile.h"
 #include "nsISimpleEnumerator.h"
 #include "nsIXULRuntime.h"
 #include "GMPDecoderModule.h"
 #include <limits>
-#include "MediaPrefs.h"
 #include "mozilla/SystemGroup.h"
 
 using mozilla::ipc::Transport;
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
@@ -813,17 +813,17 @@ GeckoMediaPluginServiceParent::SelectPlu
   return nullptr;
 }
 
 RefPtr<GMPParent>
 CreateGMPParent(AbstractThread* aMainThread)
 {
 #if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
   if (!SandboxInfo::Get().CanSandboxMedia()) {
-    if (!MediaPrefs::GMPAllowInsecure()) {
+    if (!StaticPrefs::MediaGmpInsecureAllow()) {
       NS_WARNING("Denying media plugin load due to lack of sandboxing.");
       return nullptr;
     }
     NS_WARNING("Loading media plugin despite lack of sandboxing.");
   }
 #endif
   return new GMPParent(aMainThread);
 }
--- a/dom/media/gtest/TestGMPCrossOrigin.cpp
+++ b/dom/media/gtest/TestGMPCrossOrigin.cpp
@@ -7,32 +7,31 @@
 #include "gtest/gtest.h"
 #include "nsIObserverService.h"
 #include "mozilla/Services.h"
 #include "mozilla/StaticPtr.h"
 #include "GMPTestMonitor.h"
 #include "GMPVideoDecoderProxy.h"
 #include "GMPVideoEncoderProxy.h"
 #include "GMPServiceParent.h"
-#include "MediaPrefs.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/DebugOnly.h"
 #include "nsThreadUtils.h"
 
 using namespace std;
 
 using namespace mozilla;
 using namespace mozilla::gmp;
 
 struct GMPTestRunner
 {
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GMPTestRunner)
 
-  GMPTestRunner() { MediaPrefs::GetSingleton(); }
+  GMPTestRunner() {}
   void DoTest(void (GMPTestRunner::*aTestMethod)(GMPTestMonitor&));
   void RunTestGMPTestCodec1(GMPTestMonitor& aMonitor);
   void RunTestGMPTestCodec2(GMPTestMonitor& aMonitor);
   void RunTestGMPTestCodec3(GMPTestMonitor& aMonitor);
   void RunTestGMPCrossOrigin1(GMPTestMonitor& aMonitor);
   void RunTestGMPCrossOrigin2(GMPTestMonitor& aMonitor);
   void RunTestGMPCrossOrigin3(GMPTestMonitor& aMonitor);
   void RunTestGMPCrossOrigin4(GMPTestMonitor& aMonitor);
--- a/dom/media/gtest/TestGMPRemoveAndDelete.cpp
+++ b/dom/media/gtest/TestGMPRemoveAndDelete.cpp
@@ -11,17 +11,16 @@
 #include "mozilla/Services.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsIObserverService.h"
 #include "GMPVideoDecoderProxy.h"
 #include "GMPServiceParent.h"
 #include "GMPService.h"
 #include "GMPUtils.h"
 #include "mozilla/StaticPtr.h"
-#include "MediaPrefs.h"
 
 #define GMP_DIR_NAME NS_LITERAL_STRING("gmp-fakeopenh264")
 #define GMP_OLD_VERSION NS_LITERAL_STRING("1.0")
 #define GMP_NEW_VERSION NS_LITERAL_STRING("1.1")
 
 #define GMP_DELETED_TOPIC "gmp-directory-deleted"
 
 #define EXPECT_OK(X) EXPECT_TRUE(NS_SUCCEEDED(X))
@@ -223,18 +222,16 @@ GMPRemoveTest::~GMPRemoveTest()
   EXPECT_TRUE(NS_SUCCEEDED(mTmpDir->Exists(&exists)) && !exists);
 
   EXPECT_OK(GetServiceParent()->AddPluginDirectory(mOriginalPath));
 }
 
 void
 GMPRemoveTest::Setup()
 {
-  // Initialize media preferences.
-  MediaPrefs::GetSingleton();
   GeneratePlugin();
   GetService()->GetThread(getter_AddRefs(mGMPThread));
 
   // Spin the event loop until the GMP service has had a chance to complete
   // adding GMPs from MOZ_GMP_PATH. Otherwise, the RemovePluginDirectory()
   // below may complete before we're finished adding GMPs from MOZ_GMP_PATH,
   // and we'll end up not removing the GMP, and the test will fail.
   RefPtr<AbstractThread> thread(GetServiceParent()->GetAbstractGMPThread());
--- a/dom/media/gtest/TestGMPUtils.cpp
+++ b/dom/media/gtest/TestGMPUtils.cpp
@@ -2,31 +2,28 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "gtest/gtest.h"
 #include "GMPUtils.h"
 #include "nsString.h"
-#include "MediaPrefs.h"
 
 #include <string>
 #include <vector>
 
 using namespace std;
 using namespace mozilla;
 
 void TestSplitAt(const char* aInput,
                  const char* aDelims,
                  size_t aNumExpectedTokens,
                  const char* aExpectedTokens[])
 {
-  // Initialize media preferences.
-  MediaPrefs::GetSingleton();
   nsCString input(aInput);
   nsTArray<nsCString> tokens;
   SplitAt(aDelims, input, tokens);
   EXPECT_EQ(tokens.Length(), aNumExpectedTokens) << "Should get expected number of tokens";
   for (size_t i = 0; i < tokens.Length(); i++) {
     EXPECT_TRUE(tokens[i].EqualsASCII(aExpectedTokens[i]))
       << "Tokenize fail; expected=" << aExpectedTokens[i] << " got=" <<
       tokens[i].BeginReading();
--- a/dom/media/gtest/mp4_demuxer/TestParser.cpp
+++ b/dom/media/gtest/mp4_demuxer/TestParser.cpp
@@ -1,16 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "gtest/gtest.h"
 #include "MediaData.h"
-#include "MediaPrefs.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Preferences.h"
 #include "BufferStream.h"
 #include "MP4Metadata.h"
 #include "MoofParser.h"
 
 class TestStream;
 namespace mozilla {
--- a/dom/media/hls/HLSDecoder.cpp
+++ b/dom/media/hls/HLSDecoder.cpp
@@ -10,21 +10,21 @@
 #include "DecoderTraits.h"
 #include "GeneratedJNINatives.h"
 #include "GeneratedJNIWrappers.h"
 #include "HLSDemuxer.h"
 #include "HLSUtils.h"
 #include "MediaContainerType.h"
 #include "MediaDecoderStateMachine.h"
 #include "MediaFormatReader.h"
-#include "MediaPrefs.h"
 #include "MediaShutdownManager.h"
 #include "nsContentUtils.h"
 #include "nsNetUtil.h"
 #include "nsThreadUtils.h"
+#include "mozilla/StaticPrefs.h"
 
 using namespace mozilla::java;
 
 namespace mozilla {
 
 class HLSResourceCallbacksSupport
   : public GeckoHLSResourceWrapper::Callbacks::Natives<HLSResourceCallbacksSupport>
 {
@@ -122,17 +122,17 @@ HLSDecoder::CreateStateMachine()
     new MediaFormatReader(init, new HLSDemuxer(mHLSResourceWrapper->GetPlayerId()));
 
   return new MediaDecoderStateMachine(this, mReader);
 }
 
 bool
 HLSDecoder::IsEnabled()
 {
-  return MediaPrefs::HLSEnabled() && (jni::GetAPIVersion() >= 16);
+  return StaticPrefs::MediaHlsEnabled() && (jni::GetAPIVersion() >= 16);
 }
 
 bool
 HLSDecoder::IsSupportedType(const MediaContainerType& aContainerType)
 {
   return IsEnabled() &&
          DecoderTraits::IsHttpLiveStreamingType(aContainerType);
 }
--- a/dom/media/ipc/RemoteVideoDecoder.cpp
+++ b/dom/media/ipc/RemoteVideoDecoder.cpp
@@ -1,20 +1,21 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=99: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
 #include "RemoteVideoDecoder.h"
 #include "VideoDecoderChild.h"
 #include "VideoDecoderManagerChild.h"
 #include "mozilla/layers/TextureClient.h"
+#include "mozilla/StaticPrefs.h"
 #include "base/thread.h"
 #include "MediaInfo.h"
-#include "MediaPrefs.h"
 #include "ImageContainer.h"
 #include "mozilla/layers/SynchronousTask.h"
 
 namespace mozilla {
 namespace dom {
 
 using base::Thread;
 using namespace ipc;
@@ -165,17 +166,17 @@ IsRemoteAcceleratedCompositor(KnowsCompo
   TextureFactoryIdentifier ident = aKnows->GetTextureFactoryIdentifier();
   return ident.mParentBackend != LayersBackend::LAYERS_BASIC &&
          ident.mParentProcessType == GeckoProcessType_GPU;
 }
 
 already_AddRefed<MediaDataDecoder>
 RemoteDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams)
 {
-  if (!MediaPrefs::PDMUseGPUDecoder() ||
+  if (!StaticPrefs::MediaGpuProcessDecoder() ||
       !aParams.mKnowsCompositor ||
       !IsRemoteAcceleratedCompositor(aParams.mKnowsCompositor))
   {
     return mWrapped->CreateVideoDecoder(aParams);
   }
 
   RefPtr<RemoteVideoDecoder> object = new RemoteVideoDecoder();
 
--- a/dom/media/ipc/VideoDecoderManagerChild.cpp
+++ b/dom/media/ipc/VideoDecoderManagerChild.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=99: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
 #include "VideoDecoderManagerChild.h"
 #include "VideoDecoderChild.h"
 #include "mozilla/dom/ContentChild.h"
-#include "MediaPrefs.h"
 #include "nsThreadUtils.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/ipc/ProtocolUtils.h"
 #include "mozilla/layers/SynchronousTask.h"
 #include "mozilla/gfx/DataSurfaceHelpers.h"
 #include "mozilla/layers/ISurfaceAllocator.h"
 #include "base/task.h"
 
--- a/dom/media/mediasink/AudioSink.cpp
+++ b/dom/media/mediasink/AudioSink.cpp
@@ -8,17 +8,17 @@
 #include "MediaQueue.h"
 #include "AudioSink.h"
 #include "VideoUtils.h"
 #include "AudioConverter.h"
 
 #include "mozilla/CheckedInt.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/IntegerPrintfMacros.h"
-#include "MediaPrefs.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 extern LazyLogModule gMediaDecoderLog;
 #define SINK_LOG(msg, ...) \
   MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, ("AudioSink=%p " msg, this, ##__VA_ARGS__))
 #define SINK_LOG_V(msg, ...) \
   MOZ_LOG(gMediaDecoderLog, LogLevel::Verbose, ("AudioSink=%p " msg, this, ##__VA_ARGS__))
@@ -43,17 +43,17 @@ AudioSink::AudioSink(AbstractThread* aTh
   , mErrored(false)
   , mPlaybackComplete(false)
   , mOwnerThread(aThread)
   , mProcessedQueueLength(0)
   , mFramesParsed(0)
   , mIsAudioDataAudible(false)
   , mAudioQueue(aAudioQueue)
 {
-  bool resampling = MediaPrefs::AudioSinkResampling();
+  bool resampling = StaticPrefs::MediaResamplingEnabled();
 
   if (resampling) {
     mOutputRate = 48000;
   } else if (mInfo.mRate == 44100 || mInfo.mRate == 48000) {
     // The original rate is of good quality and we want to minimize unecessary
     // resampling. The common scenario being that the sampling rate is one or
     // the other, this allows to minimize audio quality regression and hoping
     // content provider want change from those rates mid-stream.
@@ -190,17 +190,18 @@ AudioSink::InitializeAudioStream(const P
   mAudioStream = new AudioStream(*this);
   // When AudioQueue is empty, there is no way to know the channel layout of
   // the coming audio data, so we use the predefined channel map instead.
   AudioConfig::ChannelLayout::ChannelMap channelMap =
     mConverter ? mConverter->OutputConfig().Layout().Map()
                : AudioConfig::ChannelLayout(mOutputChannels).Map();
   // The layout map used here is already processed by mConverter with
   // mOutputChannels into SMPTE format, so there is no need to worry if
-  // MediaPrefs::MonoAudio() or MediaPrefs::AudioSinkForceStereo() is applied.
+  // StaticPrefs::accessibility_monoaudio_enable() or
+  // StaticPrefs::MediaForcestereoEnabled() is applied.
   nsresult rv = mAudioStream->Init(mOutputChannels, channelMap, mOutputRate);
   if (NS_FAILED(rv)) {
     mAudioStream->Shutdown();
     mAudioStream = nullptr;
     return rv;
   }
 
   // Set playback params before calling Start() so they can take effect
--- a/dom/media/mediasink/VideoSink.cpp
+++ b/dom/media/mediasink/VideoSink.cpp
@@ -7,20 +7,20 @@
 #ifdef XP_WIN
 // Include Windows headers required for enabling high precision timers.
 #include "windows.h"
 #include "mmsystem.h"
 #endif
 
 #include "MediaQueue.h"
 #include "VideoSink.h"
-#include "MediaPrefs.h"
 #include "VideoUtils.h"
 
 #include "mozilla/IntegerPrintfMacros.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 extern LazyLogModule gMediaDecoderLog;
 
 #undef FMT
 
 #define FMT(x, ...) "VideoSink=%p " x, this, ##__VA_ARGS__
@@ -45,17 +45,17 @@ VideoSink::VideoSink(AbstractThread* aTh
   , mAudioSink(aAudioSink)
   , mVideoQueue(aVideoQueue)
   , mContainer(aContainer)
   , mProducerID(ImageContainer::AllocateProducerID())
   , mFrameStats(aFrameStats)
   , mHasVideo(false)
   , mUpdateScheduler(aThread)
   , mVideoQueueSendToCompositorSize(aVQueueSentToCompositerSize)
-  , mMinVideoQueueSize(MediaPrefs::RuinAvSync() ? 1 : 0)
+  , mMinVideoQueueSize(StaticPrefs::MediaRuinAvSyncEnabled() ? 1 : 0)
 #ifdef XP_WIN
   , mHiResTimersRequested(false)
 #endif
 
 {
   MOZ_ASSERT(mAudioSink, "AudioSink should exist.");
 }
 
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -1,21 +1,21 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "TrackBuffersManager.h"
 #include "ContainerParser.h"
-#include "MediaPrefs.h"
 #include "MediaSourceDemuxer.h"
 #include "MediaSourceUtils.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/Preferences.h"
+#include "mozilla/StaticPrefs.h"
 #include "nsMimeTypes.h"
 #include "SourceBuffer.h"
 #include "SourceBufferResource.h"
 #include "SourceBufferTask.h"
 #include "WebMDemuxer.h"
 
 #ifdef MOZ_FMP4
 #include "MP4Demuxer.h"
@@ -942,17 +942,17 @@ TrackBuffersManager::ResetDemuxingState(
 }
 
 void
 TrackBuffersManager::OnDemuxerResetDone(const MediaResult& aResult)
 {
   MOZ_ASSERT(OnTaskQueue());
   mDemuxerInitRequest.Complete();
 
-  if (NS_FAILED(aResult) && MediaPrefs::MediaWarningsAsErrors()) {
+  if (NS_FAILED(aResult) && StaticPrefs::MediaPlaybackWarningsAsErrors()) {
     RejectAppend(aResult, __func__);
     return;
   }
 
   // mInputDemuxer shouldn't have been destroyed while a demuxer init/reset
   // request was being processed. See bug 1239983.
   MOZ_DIAGNOSTIC_ASSERT(mInputDemuxer);
 
@@ -1050,17 +1050,17 @@ TrackBuffersManager::InitializationSegme
 void
 TrackBuffersManager::OnDemuxerInitDone(const MediaResult& aResult)
 {
   MOZ_ASSERT(OnTaskQueue());
   MOZ_DIAGNOSTIC_ASSERT(mInputDemuxer, "mInputDemuxer has been destroyed");
 
   mDemuxerInitRequest.Complete();
 
-  if (NS_FAILED(aResult) && MediaPrefs::MediaWarningsAsErrors()) {
+  if (NS_FAILED(aResult) && StaticPrefs::MediaPlaybackWarningsAsErrors()) {
     RejectAppend(aResult, __func__);
     return;
   }
 
   MediaInfo info;
 
   uint32_t numVideos = mInputDemuxer->GetNumberTracks(TrackInfo::kVideoTrack);
   if (numVideos) {
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -121,17 +121,16 @@ EXPORTS += [
     'MediaDecoder.h',
     'MediaDecoderOwner.h',
     'MediaDecoderStateMachine.h',
     'MediaEventSource.h',
     'MediaFormatReader.h',
     'MediaInfo.h',
     'MediaMetadataManager.h',
     'MediaMIMETypes.h',
-    'MediaPrefs.h',
     'MediaPromiseDefs.h',
     'MediaQueue.h',
     'MediaRecorder.h',
     'MediaResource.h',
     'MediaResourceCallback.h',
     'MediaResult.h',
     'MediaSegment.h',
     'MediaShutdownManager.h',
@@ -238,17 +237,16 @@ UNIFIED_SOURCES += [
     'MediaDecoder.cpp',
     'MediaDecoderStateMachine.cpp',
     'MediaDeviceInfo.cpp',
     'MediaDevices.cpp',
     'MediaFormatReader.cpp',
     'MediaInfo.cpp',
     'MediaManager.cpp',
     'MediaMIMETypes.cpp',
-    'MediaPrefs.cpp',
     'MediaRecorder.cpp',
     'MediaResource.cpp',
     'MediaShutdownManager.cpp',
     'MediaStreamError.cpp',
     'MediaStreamGraph.cpp',
     'MediaStreamListener.cpp',
     'MediaStreamTrack.cpp',
     'MediaStreamVideoSink.cpp',
--- a/dom/media/mp4/MP4Decoder.cpp
+++ b/dom/media/mp4/MP4Decoder.cpp
@@ -1,21 +1,21 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MP4Decoder.h"
 #include "MediaContainerType.h"
-#include "MediaPrefs.h"
 #include "MP4Demuxer.h"
 #include "nsMimeTypes.h"
 #include "VideoUtils.h"
 #include "PDMFactory.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 static bool
 IsWhitelistedH264Codec(const nsAString& aCodec)
 {
   int16_t profile = 0, level = 0;
 
@@ -163,12 +163,12 @@ MP4Decoder::IsAAC(const nsACString& aMim
 {
   return aMimeType.EqualsLiteral("audio/mp4a-latm");
 }
 
 /* static */
 bool
 MP4Decoder::IsEnabled()
 {
-  return MediaPrefs::MP4Enabled();
+  return StaticPrefs::mediaMp4Enabled();
 }
 
 } // namespace mozilla
--- a/dom/media/mp4/MP4Demuxer.cpp
+++ b/dom/media/mp4/MP4Demuxer.cpp
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <algorithm>
 #include <limits>
 #include <stdint.h>
 
 #include "MP4Demuxer.h"
 
-#include "MediaPrefs.h"
+#include "mozilla/StaticPrefs.h"
 // Used for telemetry
 #include "mozilla/Telemetry.h"
 #include "AnnexB.h"
 #include "H264.h"
 #include "MoofParser.h"
 #include "MP4Metadata.h"
 #include "ResourceStream.h"
 #include "BufferStream.h"
@@ -162,29 +162,29 @@ MP4Demuxer::Init()
   nsresult rv = metadata.Parse();
   if (NS_FAILED(rv)) {
     return InitPromise::CreateAndReject(
       MediaResult(rv, RESULT_DETAIL("Parse MP4 metadata failed")), __func__);
   }
 
   auto audioTrackCount = metadata.GetNumberTracks(TrackInfo::kAudioTrack);
   if (audioTrackCount.Ref() == MP4Metadata::NumberTracksError()) {
-    if (MediaPrefs::MediaWarningsAsErrors()) {
+    if (StaticPrefs::MediaPlaybackWarningsAsErrors()) {
       return InitPromise::CreateAndReject(
         MediaResult(NS_ERROR_DOM_MEDIA_DEMUXER_ERR,
                     RESULT_DETAIL("Invalid audio track (%s)",
                                   audioTrackCount.Result().Description().get())),
         __func__);
     }
     audioTrackCount.Ref() = 0;
   }
 
   auto videoTrackCount = metadata.GetNumberTracks(TrackInfo::kVideoTrack);
   if (videoTrackCount.Ref() == MP4Metadata::NumberTracksError()) {
-    if (MediaPrefs::MediaWarningsAsErrors()) {
+    if (StaticPrefs::MediaPlaybackWarningsAsErrors()) {
       return InitPromise::CreateAndReject(
         MediaResult(NS_ERROR_DOM_MEDIA_DEMUXER_ERR,
                     RESULT_DETAIL("Invalid video track (%s)",
                                   videoTrackCount.Result().Description().get())),
         __func__);
     }
     videoTrackCount.Ref() = 0;
   }
@@ -205,17 +205,17 @@ MP4Demuxer::Init()
     result = Move(videoTrackCount.Result());
   }
 
   if (audioTrackCount.Ref() != 0) {
     for (size_t i = 0; i < audioTrackCount.Ref(); i++) {
       MP4Metadata::ResultAndTrackInfo info =
         metadata.GetTrackInfo(TrackInfo::kAudioTrack, i);
       if (!info.Ref()) {
-        if (MediaPrefs::MediaWarningsAsErrors()) {
+        if (StaticPrefs::MediaPlaybackWarningsAsErrors()) {
           return InitPromise::CreateAndReject(
             MediaResult(NS_ERROR_DOM_MEDIA_DEMUXER_ERR,
                         RESULT_DETAIL("Invalid MP4 audio track (%s)",
                                       info.Result().Description().get())),
             __func__);
         }
         if (result == NS_OK) {
           result = MediaResult(NS_ERROR_DOM_MEDIA_DEMUXER_ERR,
@@ -241,17 +241,17 @@ MP4Demuxer::Init()
     }
   }
 
   if (videoTrackCount.Ref() != 0) {
     for (size_t i = 0; i < videoTrackCount.Ref(); i++) {
       MP4Metadata::ResultAndTrackInfo info =
         metadata.GetTrackInfo(TrackInfo::kVideoTrack, i);
       if (!info.Ref()) {
-        if (MediaPrefs::MediaWarningsAsErrors()) {
+        if (StaticPrefs::MediaPlaybackWarningsAsErrors()) {
           return InitPromise::CreateAndReject(
             MediaResult(NS_ERROR_DOM_MEDIA_DEMUXER_ERR,
                         RESULT_DETAIL("Invalid MP4 video track (%s)",
                                       info.Result().Description().get())),
             __func__);
         }
         if (result == NS_OK) {
           result = MediaResult(NS_ERROR_DOM_MEDIA_DEMUXER_ERR,
--- a/dom/media/mp4/MP4Metadata.cpp
+++ b/dom/media/mp4/MP4Metadata.cpp
@@ -8,17 +8,16 @@
 #include "mozilla/Logging.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/UniquePtr.h"
 #include "VideoUtils.h"
 #include "MoofParser.h"
 #include "MP4Metadata.h"
 #include "ByteStream.h"
-#include "MediaPrefs.h"
 #include "mp4parse.h"
 
 #include <limits>
 #include <stdint.h>
 #include <vector>
 
 using mozilla::media::TimeUnit;
 
--- a/dom/media/ogg/OggDecoder.cpp
+++ b/dom/media/ogg/OggDecoder.cpp
@@ -1,27 +1,27 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "OggDecoder.h"
-#include "MediaPrefs.h"
 #include "MediaContainerType.h"
 #include "MediaDecoder.h"
 #include "nsMimeTypes.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 /* static */
 bool
 OggDecoder::IsSupportedType(const MediaContainerType& aContainerType)
 {
-  if (!MediaPrefs::OggEnabled()) {
+  if (!StaticPrefs::MediaOggEnabled()) {
     return false;
   }
 
   if (aContainerType.Type() != MEDIAMIMETYPE(AUDIO_OGG) &&
       aContainerType.Type() != MEDIAMIMETYPE(VIDEO_OGG) &&
       aContainerType.Type() != MEDIAMIMETYPE("application/ogg")) {
     return false;
   }
@@ -33,17 +33,18 @@ OggDecoder::IsSupportedType(const MediaC
     // WebM guarantees that the only codecs it contained are vp8, vp9, opus or vorbis.
     return true;
   }
   // Verify that all the codecs specified are ones that we expect that
   // we can play.
   for (const auto& codec : codecs.Range()) {
     if ((MediaDecoder::IsOpusEnabled() && codec.EqualsLiteral("opus")) ||
         codec.EqualsLiteral("vorbis") ||
-        (MediaPrefs::FlacInOgg() && codec.EqualsLiteral("flac"))) {
+        (StaticPrefs::MediaOggFlacEnabled() &&
+         codec.EqualsLiteral("flac"))) {
       continue;
     }
     // Note: Only accept Theora in a video container type, not in an audio
     // container type.
     if (isOggVideo && codec.EqualsLiteral("theora")) {
       continue;
     }
     // Some unsupported codec.
--- a/dom/media/ogg/OggDemuxer.cpp
+++ b/dom/media/ogg/OggDemuxer.cpp
@@ -7,22 +7,22 @@
 #include "nsError.h"
 #include "MediaDecoderStateMachine.h"
 #include "OggDemuxer.h"
 #include "OggCodecState.h"
 #include "mozilla/AbstractThread.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/PodOperations.h"
 #include "mozilla/SharedThreadPool.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/TimeStamp.h"
 #include "MediaDataDemuxer.h"
 #include "nsAutoRef.h"
 #include "XiphExtradata.h"
-#include "MediaPrefs.h"
 
 #include <algorithm>
 
 extern mozilla::LazyLogModule gMediaDemuxerLog;
 #define OGG_DEBUG(arg, ...)                                                    \
   DDMOZ_LOG(gMediaDemuxerLog,                                                  \
             mozilla::LogLevel::Debug,                                          \
             "::%s: " arg,                                                      \
@@ -533,17 +533,17 @@ OggDemuxer::ReadMetadata()
             SetupTarget(&mOpusState, s);
           } else {
             s->Deactivate();
           }
         } else {
           NS_WARNING("Opus decoding disabled."
                      " See media.opus.enabled in about:config");
         }
-      } else if (MediaPrefs::FlacInOgg() &&
+      } else if (StaticPrefs::MediaOggFlacEnabled() &&
                  s->GetType() == OggCodecState::TYPE_FLAC &&
                  ReadHeaders(TrackInfo::kAudioTrack, s)) {
         if (!mFlacState) {
           SetupTarget(&mFlacState, s);
         } else {
           s->Deactivate();
         }
       } else if (s->GetType() == OggCodecState::TYPE_SKELETON && !mSkeletonState) {
--- a/dom/media/platforms/PDMFactory.cpp
+++ b/dom/media/platforms/PDMFactory.cpp
@@ -23,21 +23,21 @@
 #include "AndroidDecoderModule.h"
 #endif
 #include "GMPDecoderModule.h"
 
 #include "mozilla/CDMProxy.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/SharedThreadPool.h"
 #include "mozilla/StaticPtr.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/SyncRunnable.h"
 #include "mozilla/TaskQueue.h"
 
 #include "MediaInfo.h"
-#include "MediaPrefs.h"
 #include "H264Converter.h"
 
 #include "AgnosticDecoderModule.h"
 #include "EMEDecoderModule.h"
 
 #include "DecoderDoctorDiagnostics.h"
 
 #include "MP4Decoder.h"
@@ -328,64 +328,65 @@ PDMFactory::Supports(const TrackInfo& aT
   return !!current;
 }
 
 void
 PDMFactory::CreatePDMs()
 {
   RefPtr<PlatformDecoderModule> m;
 
-  if (MediaPrefs::PDMUseBlankDecoder()) {
+  if (StaticPrefs::MediaUseBlankDecoder()) {
     m = CreateBlankDecoderModule();
     StartupPDM(m);
     // The Blank PDM SupportsMimeType reports true for all codecs; the creation
     // of its decoder is infallible. As such it will be used for all media, we
     // can stop creating more PDM from this point.
     return;
   }
 
 #ifdef XP_WIN
-  if (MediaPrefs::PDMWMFEnabled() && !IsWin7AndPre2000Compatible()) {
+  if (StaticPrefs::MediaWmfEnabled() && !IsWin7AndPre2000Compatible()) {
     m = new WMFDecoderModule();
     RefPtr<PlatformDecoderModule> remote = new dom::RemoteDecoderModule(m);
     StartupPDM(remote);
     mWMFFailedToLoad = !StartupPDM(m);
   } else {
-    mWMFFailedToLoad = MediaPrefs::DecoderDoctorWMFDisabledIsFailure();
+    mWMFFailedToLoad =
+      StaticPrefs::MediaDecoderDoctorWmfDisabledIsFailure();
   }
 #endif
 #ifdef MOZ_FFVPX
-  if (MediaPrefs::PDMFFVPXEnabled()) {
+  if (StaticPrefs::MediaFfvpxEnabled()) {
     m = FFVPXRuntimeLinker::CreateDecoderModule();
     StartupPDM(m);
   }
 #endif
 #ifdef MOZ_FFMPEG
-  if (MediaPrefs::PDMFFmpegEnabled()) {
+  if (StaticPrefs::MediaFfmpegEnabled()) {
     m = FFmpegRuntimeLinker::CreateDecoderModule();
     mFFmpegFailedToLoad = !StartupPDM(m);
   } else {
     mFFmpegFailedToLoad = false;
   }
 #endif
 #ifdef MOZ_APPLEMEDIA
   m = new AppleDecoderModule();
   StartupPDM(m);
 #endif
 #ifdef MOZ_WIDGET_ANDROID
-  if(MediaPrefs::PDMAndroidMediaCodecEnabled()){
+  if (StaticPrefs::MediaAndroidMediaCodecEnabled()) {
     m = new AndroidDecoderModule();
-    StartupPDM(m, MediaPrefs::PDMAndroidMediaCodecPreferred());
+    StartupPDM(m, StaticPrefs::MediaAndroidMediaCodecPreferred());
   }
 #endif
 
   m = new AgnosticDecoderModule();
   StartupPDM(m);
 
-  if (MediaPrefs::PDMGMPEnabled()) {
+  if (StaticPrefs::MediaGmpDecoderEnabled()) {
     m = new GMPDecoderModule();
     mGMPPDMFailedToStartup = !StartupPDM(m);
   } else {
     mGMPPDMFailedToStartup = false;
   }
 }
 
 void
--- a/dom/media/platforms/agnostic/AgnosticDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/AgnosticDecoderModule.cpp
@@ -1,22 +1,22 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "AgnosticDecoderModule.h"
-#include "MediaPrefs.h"
 #include "OpusDecoder.h"
 #include "TheoraDecoder.h"
 #include "VPXDecoder.h"
 #include "VorbisDecoder.h"
 #include "WAVDecoder.h"
 #include "mozilla/Logging.h"
+#include "mozilla/StaticPrefs.h"
 
 #ifdef MOZ_AV1
 #include "AOMDecoder.h"
 #endif
 
 namespace mozilla {
 
 bool
@@ -26,17 +26,17 @@ AgnosticDecoderModule::SupportsMimeType(
 {
   bool supports =
     VPXDecoder::IsVPX(aMimeType) ||
     OpusDataDecoder::IsOpus(aMimeType) ||
     VorbisDataDecoder::IsVorbis(aMimeType) ||
     WaveDataDecoder::IsWave(aMimeType) ||
     TheoraDecoder::IsTheora(aMimeType);
 #ifdef MOZ_AV1
-  if (MediaPrefs::AV1Enabled()) {
+  if (StaticPrefs::MediaAv1Enabled()) {
     supports |= AOMDecoder::IsAV1(aMimeType);
   }
 #endif
   MOZ_LOG(sPDMLog, LogLevel::Debug, ("Agnostic decoder %s requested type",
         supports ? "supports" : "rejects"));
   return supports;
 }
 
@@ -45,17 +45,17 @@ AgnosticDecoderModule::CreateVideoDecode
 {
   RefPtr<MediaDataDecoder> m;
 
   if (VPXDecoder::IsVPX(aParams.mConfig.mMimeType)) {
     m = new VPXDecoder(aParams);
   }
 #ifdef MOZ_AV1
   else if (AOMDecoder::IsAV1(aParams.mConfig.mMimeType) &&
-           MediaPrefs::AV1Enabled()) {
+           StaticPrefs::MediaAv1Enabled()) {
     m = new AOMDecoder(aParams);
   }
 #endif
   else if (TheoraDecoder::IsTheora(aParams.mConfig.mMimeType)) {
     m = new TheoraDecoder(aParams);
   }
 
   return m.forget();
--- a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
@@ -7,21 +7,21 @@
 #include "EMEDecoderModule.h"
 
 #include <inttypes.h>
 
 #include "Adts.h"
 #include "GMPDecoderModule.h"
 #include "GMPService.h"
 #include "MediaInfo.h"
-#include "MediaPrefs.h"
 #include "PDMFactory.h"
 #include "mozIGeckoMediaPluginService.h"
 #include "mozilla/CDMProxy.h"
 #include "mozilla/EMEUtils.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/Unused.h"
 #include "nsAutoPtr.h"
 #include "nsClassHashtable.h"
 #include "nsServiceManagerUtils.h"
 #include "DecryptThroughputLimit.h"
 #include "ChromiumCDMVideoDecoder.h"
 
@@ -404,17 +404,17 @@ CreateDecoderWrapper(CDMProxy* aProxy, c
   return decoder.forget();
 }
 
 already_AddRefed<MediaDataDecoder>
 EMEDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams)
 {
   MOZ_ASSERT(aParams.mConfig.mCrypto.mValid);
 
-  if (MediaPrefs::EMEBlankVideo()) {
+  if (StaticPrefs::MediaEmeVideoBlank()) {
     EME_LOG("EMEDecoderModule::CreateVideoDecoder() creating a blank decoder.");
     RefPtr<PlatformDecoderModule> m(CreateBlankDecoderModule());
     return m->CreateVideoDecoder(aParams);
   }
 
   if (SupportsMimeType(aParams.mConfig.mMimeType, nullptr)) {
     // GMP decodes. Assume that means it can decrypt too.
     RefPtr<MediaDataDecoderProxy> wrapper =
@@ -440,17 +440,17 @@ already_AddRefed<MediaDataDecoder>
 EMEDecoderModule::CreateAudioDecoder(const CreateDecoderParams& aParams)
 {
   MOZ_ASSERT(aParams.mConfig.mCrypto.mValid);
 
   // We don't support using the GMP to decode audio.
   MOZ_ASSERT(!SupportsMimeType(aParams.mConfig.mMimeType, nullptr));
   MOZ_ASSERT(mPDM);
 
-  if (MediaPrefs::EMEBlankAudio()) {
+  if (StaticPrefs::MediaEmeAudioBlank()) {
     EME_LOG("EMEDecoderModule::CreateAudioDecoder() creating a blank decoder.");
     RefPtr<PlatformDecoderModule> m(CreateBlankDecoderModule());
     return m->CreateAudioDecoder(aParams);
   }
 
   UniquePtr<ADTSSampleConverter> converter = nullptr;
   if (MP4Decoder::IsAAC(aParams.mConfig.mMimeType)) {
     // The CDM expects encrypted AAC to be in ADTS format.
--- a/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp
@@ -6,17 +6,16 @@
 
 #include "DecoderDoctorDiagnostics.h"
 #include "GMPDecoderModule.h"
 #include "GMPService.h"
 #include "GMPUtils.h"
 #include "GMPVideoDecoder.h"
 #include "MP4Decoder.h"
 #include "MediaDataDecoderProxy.h"
-#include "MediaPrefs.h"
 #include "VPXDecoder.h"
 #include "VideoUtils.h"
 #include "gmp-video-decode.h"
 #include "mozIGeckoMediaPluginService.h"
 #include "mozilla/StaticMutex.h"
 #include "nsServiceManagerUtils.h"
 #ifdef XP_WIN
 #include "WMFDecoderModule.h"
--- a/dom/media/platforms/android/AndroidDecoderModule.cpp
+++ b/dom/media/platforms/android/AndroidDecoderModule.cpp
@@ -1,15 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "GeneratedJNIWrappers.h"
 #include "MediaInfo.h"
-#include "MediaPrefs.h"
 #include "OpusDecoder.h"
 #include "RemoteDataDecoder.h"
 #include "VPXDecoder.h"
 #include "VorbisDecoder.h"
 
 #include "nsIGfxInfo.h"
 #include "nsPromiseFlatString.h"
 
--- a/dom/media/platforms/apple/AppleDecoderModule.cpp
+++ b/dom/media/platforms/apple/AppleDecoderModule.cpp
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "AppleATDecoder.h"
 #include "AppleCMLinker.h"
 #include "AppleDecoderModule.h"
 #include "AppleVTDecoder.h"
 #include "AppleVTLinker.h"
 #include "MacIOSurfaceImage.h"
-#include "MediaPrefs.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/Logging.h"
 #include "mozilla/gfx/gfxVars.h"
 
 namespace mozilla {
 
 bool AppleDecoderModule::sInitialized = false;
 bool AppleDecoderModule::sIsCoreMediaAvailable = false;
--- a/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h
+++ b/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h
@@ -6,17 +6,17 @@
 
 #ifndef __FFmpegDecoderModule_h__
 #define __FFmpegDecoderModule_h__
 
 #include "PlatformDecoderModule.h"
 #include "FFmpegLibWrapper.h"
 #include "FFmpegAudioDecoder.h"
 #include "FFmpegVideoDecoder.h"
-#include "MediaPrefs.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 template <int V>
 class FFmpegDecoderModule : public PlatformDecoderModule
 {
 public:
   static already_AddRefed<PlatformDecoderModule>
@@ -37,17 +37,17 @@ public:
     // Bug 1263836 will handle alpha scenario once implemented. It will shift
     // the check for alpha to PDMFactory but not itself remove the need for a
     // check.
     if (aParams.VideoConfig().HasAlpha()) {
       return nullptr;
     }
     if (aParams.mOptions.contains(
           CreateDecoderParams::Option::LowLatency) &&
-        !MediaPrefs::PDMFFmpegLowLatencyEnabled()) {
+        !StaticPrefs::MediaFfmpegLowLatencyEnabled()) {
       return nullptr;
     }
     RefPtr<MediaDataDecoder> decoder = new FFmpegVideoDecoder<V>(
       mLib,
       aParams.mTaskQueue,
       aParams.VideoConfig(),
       aParams.mKnowsCompositor,
       aParams.mImageContainer,
--- a/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
@@ -1,16 +1,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "FFmpegLibWrapper.h"
 #include "FFmpegLog.h"
-#include "MediaPrefs.h"
 #include "mozilla/PodOperations.h"
+#ifdef MOZ_FFMPEG
+#include "mozilla/StaticPrefs.h"
+#endif
 #include "mozilla/Types.h"
 #include "PlatformDecoderModule.h"
 #include "prlink.h"
 
 #define AV_LOG_DEBUG    48
 #define AV_LOG_INFO     32
 
 namespace mozilla
@@ -40,17 +42,17 @@ FFmpegLibWrapper::Link()
     if (macro == 57) {
       // Due to current AVCodecContext binary incompatibility we can only
       // support FFmpeg 57 at this stage.
       Unlink();
       return LinkResult::CannotUseLibAV57;
     }
 #ifdef MOZ_FFMPEG
     if (version < (54u << 16 | 35u << 8 | 1u) &&
-        !MediaPrefs::LibavcodecAllowObsolete()) {
+        !StaticPrefs::MediaLibavcodecAllowObsolete()) {
       // Refuse any libavcodec version prior to 54.35.1.
       // (Unless media.libavcodec.allow-obsolete==true)
       Unlink();
       return LinkResult::BlockedOldLibAVVersion;
     }
 #endif
   }
 
--- a/dom/media/platforms/wmf/WMFDecoderModule.cpp
+++ b/dom/media/platforms/wmf/WMFDecoderModule.cpp
@@ -4,27 +4,27 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "WMFDecoderModule.h"
 #include "GfxDriverInfo.h"
 #include "MFTDecoder.h"
 #include "MP4Decoder.h"
 #include "MediaInfo.h"
-#include "MediaPrefs.h"
 #include "VPXDecoder.h"
 #include "WMF.h"
 #include "WMFAudioMFTManager.h"
 #include "WMFMediaDataDecoder.h"
 #include "WMFVideoMFTManager.h"
 #include "gfxPrefs.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/Services.h"
 #include "mozilla/StaticMutex.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/WindowsVersion.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "nsAutoPtr.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIGfxInfo.h"
 #include "nsIWindowsRegKey.h"
 #include "nsServiceManagerUtils.h"
 #include "nsWindowsHelpers.h"
@@ -50,17 +50,17 @@ WMFDecoderModule::~WMFDecoderModule()
 /* static */
 void
 WMFDecoderModule::Init()
 {
   if (XRE_IsContentProcess()) {
     // If we're in the content process and the UseGPUDecoder pref is set, it
     // means that we've given up on the GPU process (it's been crashing) so we
     // should disable DXVA
-    sDXVAEnabled = !MediaPrefs::PDMUseGPUDecoder();
+    sDXVAEnabled = !StaticPrefs::MediaGpuProcessDecoder();
   } else if (XRE_IsGPUProcess()) {
     // Always allow DXVA in the GPU process.
     sDXVAEnabled = true;
   } else {
     // Only allow DXVA in the UI process if we aren't in e10s Firefox
     sDXVAEnabled = !mozilla::BrowserTabsRemoteAutostart();
   }
 
@@ -208,17 +208,17 @@ WMFDecoderModule::Supports(const TrackIn
   }
   if (MP4Decoder::IsH264(aTrackInfo.mMimeType) && WMFDecoderModule::HasH264()) {
     return true;
   }
   if (aTrackInfo.mMimeType.EqualsLiteral("audio/mpeg") &&
       CanCreateWMFDecoder<CLSID_CMP3DecMediaObject>()) {
     return true;
   }
-  if (MediaPrefs::PDMWMFVP9DecoderEnabled()) {
+  if (StaticPrefs::MediaWmfVp9Enabled()) {
     static const uint32_t VP8_USABLE_BUILD = 16287;
     if (VPXDecoder::IsVP8(aTrackInfo.mMimeType) &&
         IsWindowsBuildOrLater(VP8_USABLE_BUILD) &&
         CanCreateWMFDecoder<CLSID_WebmMfVpxDec>()) {
       return true;
     }
     if (VPXDecoder::IsVP9(aTrackInfo.mMimeType) &&
         ((gfxPrefs::PDMWMFAMDVP9DecoderEnabled() &&
--- a/dom/media/platforms/wrappers/H264Converter.cpp
+++ b/dom/media/platforms/wrappers/H264Converter.cpp
@@ -4,18 +4,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "H264Converter.h"
 
 #include "DecoderDoctorDiagnostics.h"
 #include "ImageContainer.h"
 #include "MediaInfo.h"
-#include "MediaPrefs.h"
 #include "PDMFactory.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/TaskQueue.h"
 #include "AnnexB.h"
 #include "H264.h"
 
 namespace mozilla
 {
 
 H264Converter::H264Converter(PlatformDecoderModule* aPDM,
@@ -359,17 +359,17 @@ H264Converter::CreateDecoderAndInit(Medi
   }
   return rv;
 }
 
 bool
 H264Converter::CanRecycleDecoder() const
 {
   MOZ_ASSERT(mDecoder);
-  return MediaPrefs::MediaDecoderCheckRecycling() &&
+  return StaticPrefs::MediaDecoderRecycleEnabled() &&
          mDecoder->SupportDecoderRecycling();
 }
 
 void
 H264Converter::DecodeFirstSample(MediaRawData* aSample)
 {
   if (mNeedKeyframe && !aSample->mKeyframe) {
     mDecodePromise.Resolve(mPendingFrames, __func__);
--- a/dom/media/webm/WebMDecoder.cpp
+++ b/dom/media/webm/WebMDecoder.cpp
@@ -1,21 +1,21 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "WebMDecoder.h"
 #include "mozilla/Preferences.h"
+#include "mozilla/StaticPrefs.h"
 #ifdef MOZ_AV1
 #include "AOMDecoder.h"
 #endif
 #include "MediaContainerType.h"
-#include "MediaPrefs.h"
 #include "PDMFactory.h"
 #include "VideoUtils.h"
 
 namespace mozilla {
 
 /* static */
 bool
 WebMDecoder::IsSupportedType(const MediaContainerType& aContainerType)
@@ -65,17 +65,17 @@ WebMDecoder::IsSupportedType(const Media
           if (!platform->Supports(*trackInfo, nullptr)) {
             return false;
           }
         }
         continue;
       }
     }
 #ifdef MOZ_AV1
-    if (isVideo && MediaPrefs::AV1Enabled() &&
+    if (isVideo && StaticPrefs::MediaAv1Enabled() &&
         AOMDecoder::IsSupportedCodec(codec)) {
       continue;
     }
 #endif
     // Some unsupported codec.
     return false;
   }
   return true;
--- a/dom/media/webspeech/recognition/SpeechRecognition.cpp
+++ b/dom/media/webspeech/recognition/SpeechRecognition.cpp
@@ -11,18 +11,18 @@
 
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/SpeechRecognitionBinding.h"
 #include "mozilla/dom/MediaStreamTrackBinding.h"
 #include "mozilla/dom/MediaStreamError.h"
 #include "mozilla/MediaManager.h"
 #include "mozilla/Preferences.h"
-#include "MediaPrefs.h"
 #include "mozilla/Services.h"
+#include "mozilla/StaticPrefs.h"
 
 #include "AudioSegment.h"
 #include "DOMMediaStream.h"
 #include "MediaEnginePrefs.h"
 #include "endpointer.h"
 
 #include "mozilla/dom/SpeechRecognitionEvent.h"
 #include "nsContentUtils.h"
@@ -82,17 +82,17 @@ GetSpeechRecognitionService(const nsAStr
       NS_LITERAL_CSTRING(DEFAULT_RECOGNITION_SERVICE_PREFIX) +
       NS_ConvertUTF16toUTF8(aLang);
   } else if (!prefValue.IsEmpty()) {
     speechRecognitionService = prefValue;
   } else {
     speechRecognitionService = DEFAULT_RECOGNITION_SERVICE;
   }
 
-  if (MediaPrefs::WebSpeechFakeRecognitionService()) {
+  if (StaticPrefs::MediaWebspeechTextFakeRecognitionService()) {
     speechRecognitionServiceCID =
       NS_SPEECH_RECOGNITION_SERVICE_CONTRACTID_PREFIX "fake";
   } else {
     speechRecognitionServiceCID =
       NS_LITERAL_CSTRING(NS_SPEECH_RECOGNITION_SERVICE_CONTRACTID_PREFIX) +
       speechRecognitionService;
   }
 
@@ -120,17 +120,17 @@ SpeechRecognition::SpeechRecognition(nsP
   , mAudioSamplesPerChunk(mEndpointer.FrameSize())
   , mSpeechDetectionTimer(NS_NewTimer())
   , mSpeechGrammarList(new SpeechGrammarList(GetParentObject()))
   , mInterimResults(false)
   , mMaxAlternatives(1)
 {
   SR_LOG("created SpeechRecognition");
 
-  if (MediaPrefs::WebSpeechTestEnabled()) {
+  if (StaticPrefs::MediaWebspeechTestEnable()) {
     nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
     obs->AddObserver(this, SPEECH_RECOGNITION_TEST_EVENT_REQUEST_TOPIC, false);
     obs->AddObserver(this, SPEECH_RECOGNITION_TEST_END_TOPIC, false);
   }
 
   mEndpointer.set_speech_input_complete_silence_length(
       Preferences::GetInt(PREFERENCE_ENDPOINTER_SILENCE_LENGTH, 1250000));
   mEndpointer.set_long_speech_input_complete_silence_length(
@@ -176,19 +176,20 @@ SpeechRecognition::IsAuthorized(JSContex
     principal, "speech-recognition", &speechRecognition);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return false;
   }
 
   bool hasPermission =
     (speechRecognition == nsIPermissionManager::ALLOW_ACTION);
 
-  return (hasPermission || MediaPrefs::WebSpeechRecognitionForceEnabled() ||
-          MediaPrefs::WebSpeechTestEnabled()) &&
-         MediaPrefs::WebSpeechRecognitionEnabled();
+  return (hasPermission ||
+          StaticPrefs::MediaWebspeechRecognitionForceEnable() ||
+          StaticPrefs::MediaWebspeechTestEnable()) &&
+         StaticPrefs::MediaWebspeechRecognitionEnable();
 }
 
 already_AddRefed<SpeechRecognition>
 SpeechRecognition::Constructor(const GlobalObject& aGlobal,
                                ErrorResult& aRv)
 {
   nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aGlobal.GetAsSupports());
   if (!win) {
@@ -615,17 +616,17 @@ SpeechRecognition::Observe(nsISupports* 
 
     DispatchError(SpeechRecognition::EVENT_AUDIO_ERROR,
                   SpeechRecognitionErrorCode::No_speech,
                   NS_LITERAL_STRING("No speech detected (timeout)"));
   } else if (!strcmp(aTopic, SPEECH_RECOGNITION_TEST_END_TOPIC)) {
     nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
     obs->RemoveObserver(this, SPEECH_RECOGNITION_TEST_EVENT_REQUEST_TOPIC);
     obs->RemoveObserver(this, SPEECH_RECOGNITION_TEST_END_TOPIC);
-  } else if (MediaPrefs::WebSpeechFakeFSMEvents() &&
+  } else if (StaticPrefs::MediaWebspeechTextFakeFsmEvents() &&
              !strcmp(aTopic, SPEECH_RECOGNITION_TEST_EVENT_REQUEST_TOPIC)) {
     ProcessTestEventRequest(aSubject, nsDependentString(aData));
   }
 
   return NS_OK;
 }
 
 void
@@ -635,19 +636,19 @@ SpeechRecognition::ProcessTestEventReque
   if (aEventName.EqualsLiteral("EVENT_ABORT")) {
     Abort();
   } else if (aEventName.EqualsLiteral("EVENT_AUDIO_ERROR")) {
     DispatchError(
       SpeechRecognition::EVENT_AUDIO_ERROR,
       SpeechRecognitionErrorCode::Audio_capture, // TODO different codes?
       NS_LITERAL_STRING("AUDIO_ERROR test event"));
   } else {
-    NS_ASSERTION(MediaPrefs::WebSpeechFakeRecognitionService(),
+    NS_ASSERTION(StaticPrefs::MediaWebspeechTextFakeRecognitionService(),
                  "Got request for fake recognition service event, but "
-                 TEST_PREFERENCE_FAKE_RECOGNITION_SERVICE " is unset");
+                 "media.webspeech.test.fake_recognition_service is unset");
 
     // let the fake recognition service handle the request
   }
 }
 
 already_AddRefed<SpeechGrammarList>
 SpeechRecognition::Grammars() const
 {
--- a/dom/media/webspeech/recognition/test/FakeSpeechRecognitionService.cpp
+++ b/dom/media/webspeech/recognition/test/FakeSpeechRecognitionService.cpp
@@ -2,24 +2,24 @@
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsThreadUtils.h"
 
 #include "FakeSpeechRecognitionService.h"
-#include "MediaPrefs.h"
 
 #include "SpeechRecognition.h"
 #include "SpeechRecognitionAlternative.h"
 #include "SpeechRecognitionResult.h"
 #include "SpeechRecognitionResultList.h"
 #include "nsIObserverService.h"
 #include "mozilla/Services.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 using namespace dom;
 
 NS_IMPL_ISUPPORTS(FakeSpeechRecognitionService, nsISpeechRecognitionService, nsIObserver)
 
 FakeSpeechRecognitionService::FakeSpeechRecognitionService()
@@ -62,19 +62,19 @@ NS_IMETHODIMP
 FakeSpeechRecognitionService::Abort()
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 FakeSpeechRecognitionService::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData)
 {
-  MOZ_ASSERT(MediaPrefs::WebSpeechFakeRecognitionService(),
+  MOZ_ASSERT(StaticPrefs::MediaWebspeechTextFakeRecognitionService(),
              "Got request to fake recognition service event, but "
-             TEST_PREFERENCE_FAKE_RECOGNITION_SERVICE " is not set");
+             "media.webspeech.test.fake_recognition_service is not set");
 
   if (!strcmp(aTopic, SPEECH_RECOGNITION_TEST_END_TOPIC)) {
     nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
     obs->RemoveObserver(this, SPEECH_RECOGNITION_TEST_EVENT_REQUEST_TOPIC);
     obs->RemoveObserver(this, SPEECH_RECOGNITION_TEST_END_TOPIC);
 
     return NS_OK;
   }
--- a/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp
+++ b/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp
@@ -3,29 +3,29 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISpeechService.h"
 #include "nsServiceManagerUtils.h"
 #include "nsCategoryManagerUtils.h"
 
-#include "MediaPrefs.h"
 #include "SpeechSynthesisUtterance.h"
 #include "SpeechSynthesisVoice.h"
 #include "nsSynthVoiceRegistry.h"
 #include "nsSpeechTask.h"
 #include "AudioChannelService.h"
 
 #include "nsString.h"
 #include "mozilla/ClearOnShutdown.h"
-#include "mozilla/StaticPtr.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/intl/LocaleService.h"
+#include "mozilla/StaticPrefs.h"
+#include "mozilla/StaticPtr.h"
 #include "mozilla/Unused.h"
 
 #include "SpeechSynthesisChild.h"
 #include "SpeechSynthesisParent.h"
 
 using mozilla::intl::LocaleService;
 
 #undef LOG
@@ -341,17 +341,18 @@ nsSynthVoiceRegistry::RemoveVoice(nsISpe
   if(NS_WARN_IF(!(aService == retval->mService))) {
     return NS_ERROR_INVALID_ARG;
   }
 
   mVoices.RemoveElement(retval);
   mDefaultVoices.RemoveElement(retval);
   mUriVoiceMap.Remove(aUri);
 
-  if (retval->mIsQueued && !MediaPrefs::WebSpeechForceGlobal()) {
+  if (retval->mIsQueued &&
+      !StaticPrefs::MediaWebspeechSynthForceGlobalQueue()) {
     // Check if this is the last queued voice, and disable the global queue if
     // it is.
     bool queued = false;
     for (uint32_t i = 0; i < mVoices.Length(); i++) {
       VoiceData* voice = mVoices[i];
       if (voice->mIsQueued) {
         queued = true;
         break;
@@ -712,17 +713,18 @@ nsSynthVoiceRegistry::Speak(const nsAStr
   if (!voice) {
     NS_WARNING("No voices found.");
     aTask->ForceError(0, 0);
     return;
   }
 
   aTask->SetChosenVoiceURI(voice->mUri);
 
-  if (mUseGlobalQueue || MediaPrefs::WebSpeechForceGlobal()) {
+  if (mUseGlobalQueue ||
+      StaticPrefs::MediaWebspeechSynthForceGlobalQueue()) {
     LOG(LogLevel::Debug,
         ("nsSynthVoiceRegistry::Speak queueing text='%s' lang='%s' uri='%s' rate=%f pitch=%f",
          NS_ConvertUTF16toUTF8(aText).get(), NS_ConvertUTF16toUTF8(aLang).get(),
          NS_ConvertUTF16toUTF8(aUri).get(), aRate, aPitch));
     RefPtr<GlobalQueueItem> item = new GlobalQueueItem(voice, aTask, aText,
                                                          aVolume, aRate, aPitch);
     mGlobalQueue.AppendElement(item);
 
@@ -791,17 +793,18 @@ nsSynthVoiceRegistry::IsSpeaking()
 
 void
 nsSynthVoiceRegistry::SetIsSpeaking(bool aIsSpeaking)
 {
   MOZ_ASSERT(XRE_IsParentProcess());
 
   // Only set to 'true' if global queue is enabled.
   mIsSpeaking =
-    aIsSpeaking && (mUseGlobalQueue || MediaPrefs::WebSpeechForceGlobal());
+    aIsSpeaking && (mUseGlobalQueue ||
+                    StaticPrefs::MediaWebspeechSynthForceGlobalQueue());
 
   nsTArray<SpeechSynthesisParent*> ssplist;
   GetAllSpeechSynthActors(ssplist);
   for (uint32_t i = 0; i < ssplist.Length(); ++i) {
     Unused << ssplist[i]->SendIsSpeakingChanged(aIsSpeaking);
   }
 }
 
--- a/gfx/ipc/GPUProcessManager.cpp
+++ b/gfx/ipc/GPUProcessManager.cpp
@@ -7,16 +7,17 @@
 #include "GPUProcessManager.h"
 
 #include "gfxPrefs.h"
 #include "GPUProcessHost.h"
 #include "GPUProcessListener.h"
 #include "mozilla/MemoryReportingProcess.h"
 #include "mozilla/Sprintf.h"
 #include "mozilla/StaticPtr.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/layers/APZCTreeManagerChild.h"
 #include "mozilla/layers/CompositorBridgeParent.h"
 #include "mozilla/layers/CompositorManagerChild.h"
 #include "mozilla/layers/CompositorManagerParent.h"
 #include "mozilla/layers/CompositorOptions.h"
 #include "mozilla/layers/ImageBridgeChild.h"
@@ -32,17 +33,16 @@
 #include "nsContentUtils.h"
 #include "VRManagerChild.h"
 #include "VRManagerParent.h"
 #include "VsyncBridgeChild.h"
 #include "VsyncIOThreadHolder.h"
 #include "VsyncSource.h"
 #include "mozilla/dom/VideoDecoderManagerChild.h"
 #include "mozilla/dom/VideoDecoderManagerParent.h"
-#include "MediaPrefs.h"
 #include "nsExceptionHandler.h"
 #include "nsPrintfCString.h"
 
 #if defined(MOZ_WIDGET_ANDROID)
 #include "mozilla/widget/AndroidUiThread.h"
 #include "mozilla/layers/UiCompositorControllerChild.h"
 #endif // defined(MOZ_WIDGET_ANDROID)
 
@@ -976,17 +976,17 @@ GPUProcessManager::CreateContentVRManage
   return true;
 }
 
 void
 GPUProcessManager::CreateContentVideoDecoderManager(base::ProcessId aOtherProcess,
                                                     ipc::Endpoint<dom::PVideoDecoderManagerChild>* aOutEndpoint)
 {
   if (!EnsureGPUReady() ||
-      !MediaPrefs::PDMUseGPUDecoder() ||
+      !StaticPrefs::MediaGpuProcessDecoder() ||
       !mDecodeVideoOnGpuProcess) {
     return;
   }
 
   ipc::Endpoint<dom::PVideoDecoderManagerParent> parentPipe;
   ipc::Endpoint<dom::PVideoDecoderManagerChild> childPipe;
 
   nsresult rv = dom::PVideoDecoderManager::CreateEndpoints(
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -26,17 +26,16 @@
 
 #include "gfxCrashReporterUtils.h"
 #include "gfxPlatform.h"
 #include "gfxPrefs.h"
 #include "gfxEnv.h"
 #include "gfxTextRun.h"
 #include "gfxUserFontSet.h"
 #include "gfxConfig.h"
-#include "MediaPrefs.h"
 #include "VRThread.h"
 
 #ifdef XP_WIN
 #include <process.h>
 #define getpid _getpid
 #else
 #include <unistd.h>
 #endif
@@ -652,17 +651,16 @@ gfxPlatform::Init()
 
     if (gEverInitialized) {
         MOZ_CRASH("Already started???");
     }
     gEverInitialized = true;
 
     // Initialize the preferences by creating the singleton.
     gfxPrefs::GetSingleton();
-    MediaPrefs::GetSingleton();
     gfxVars::Initialize();
 
     gfxConfig::Init();
 
     if (XRE_IsParentProcess()) {
       GPUProcessManager::Initialize();
 
       if (Preferences::GetBool("media.wmf.skip-blacklist")) {
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -100,17 +100,16 @@
 #include "nsApplicationCacheService.h"
 #include "mozilla/dom/CustomElementRegistry.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/IMEStateManager.h"
 #include "mozilla/dom/HTMLVideoElement.h"
 #include "TouchManager.h"
 #include "DecoderDoctorLogger.h"
 #include "MediaDecoder.h"
-#include "MediaPrefs.h"
 #include "mozilla/ServoBindings.h"
 #include "mozilla/StaticPresData.h"
 #include "mozilla/dom/WebIDLGlobalNameHash.h"
 #include "mozilla/dom/ipc/IPCBlobInputStreamStorage.h"
 #include "mozilla/dom/U2FTokenManager.h"
 #include "mozilla/dom/PointerEventHandler.h"
 #include "nsHostObjectProtocolHandler.h"
 #include "nsThreadManager.h"
@@ -278,21 +277,16 @@ nsLayoutStatics::Initialize()
   PromiseDebugging::Init();
 
   mozilla::dom::WebCryptoThreadPool::Initialize();
 
   if (XRE_IsParentProcess() || XRE_IsContentProcess()) {
     InitializeServo();
   }
 
-#ifndef MOZ_WIDGET_ANDROID
-  // On Android, we instantiate it when constructing AndroidBridge.
-  MediaPrefs::GetSingleton();
-#endif
-
   // This must be initialized on the main-thread.
   mozilla::dom::IPCBlobInputStreamStorage::Initialize();
 
   mozilla::dom::U2FTokenManager::Initialize();
 
   if (XRE_IsParentProcess()) {
     // On content process we initialize DOMPrefs when PContentChild is fully
     // initialized.
--- a/media/webrtc/signaling/src/media-conduit/MediaCodecVideoCodec.cpp
+++ b/media/webrtc/signaling/src/media-conduit/MediaCodecVideoCodec.cpp
@@ -1,31 +1,31 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "CSFLog.h"
 #include "nspr.h"
+#include "mozilla/StaticPrefs.h"
 
 #include "WebrtcMediaCodecVP8VideoCodec.h"
 #include "MediaCodecVideoCodec.h"
-#include "MediaPrefs.h"
 
 namespace mozilla {
 
 static const char* mcvcLogTag ="MediaCodecVideoCodec";
 #ifdef LOGTAG
 #undef LOGTAG
 #endif
 #define LOGTAG mcvcLogTag
 
 WebrtcVideoEncoder* MediaCodecVideoCodec::CreateEncoder(CodecType aCodecType) {
   CSFLogDebug(LOGTAG,  "%s ", __FUNCTION__);
   if (aCodecType == CODEC_VP8) {
-    if (MediaPrefs::RemoteMediaCodecVP8EncoderEnabled()) {
+    if (StaticPrefs::MediaNavigatorHardwareVp8encodeAccelerationRemoteEnabled()) {
       return new WebrtcMediaCodecVP8VideoRemoteEncoder();
     } else {
       return new WebrtcMediaCodecVP8VideoEncoder();
     }
   }
   return nullptr;
 }
 
--- a/media/webrtc/signaling/src/media-conduit/MediaDataDecoderCodec.cpp
+++ b/media/webrtc/signaling/src/media-conduit/MediaDataDecoderCodec.cpp
@@ -1,37 +1,37 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MediaDataDecoderCodec.h"
-#include "MediaPrefs.h"
 #include "WebrtcMediaDataDecoderCodec.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 /* static */ WebrtcVideoEncoder*
 MediaDataDecoderCodec::CreateEncoder(
   webrtc::VideoCodecType aCodecType)
 {
   return nullptr;
 }
 
 /* static */ WebrtcVideoDecoder*
 MediaDataDecoderCodec::CreateDecoder(
   webrtc::VideoCodecType aCodecType)
 {
-  if (!MediaPrefs::MediaDataDecoderEnabled()) {
+  if (!StaticPrefs::MediaNavigatorMediadatadecoderEnabled()) {
     return nullptr;
   }
 
   switch (aCodecType) {
     case webrtc::VideoCodecType::kVideoCodecVP8:
     case webrtc::VideoCodecType::kVideoCodecVP9:
     case webrtc::VideoCodecType::kVideoCodecH264:
       break;
     default:
       return nullptr;
   }
   return new WebrtcMediaDataDecoder();
 }
 
-} // namespace mozilla
\ No newline at end of file
+} // namespace mozilla
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -558,59 +558,37 @@ pref("dom.webnotifications.enabled", tru
 pref("browser.chrome.toolbar_tips", false);
 
 // don't allow meta-refresh when backgrounded
 pref("browser.meta_refresh_when_inactive.disabled", true);
 
 // prevent video elements from preloading too much data
 pref("media.preload.default", 1); // default to preload none
 pref("media.preload.auto", 2);    // preload metadata if preload=auto
-pref("media.cache_size", 32768);    // 32MB media cache
-// Try to save battery by not resuming reading from a connection until we fall
-// below 10s of buffered data.
-pref("media.cache_resume_threshold", 10);
-pref("media.cache_readahead_limit", 30);
 // On mobile we'll throttle the download once the readahead_limit is hit,
 // even if the download is slow. This is to preserve battery and data.
 pref("media.throttle-regardless-of-download-rate", true);
 
 // Number of video frames we buffer while decoding video.
 // On Android this is decided by a similar value which varies for
 // each OMX decoder |OMX_PARAM_PORTDEFINITIONTYPE::nBufferCountMin|. This
 // number must be less than the OMX equivalent or gecko will think it is
 // chronically starved of video frames. All decoders seen so far have a value
 // of at least 4.
 pref("media.video-queue.default-size", 3);
 // The maximum number of queued frames to send to the compositor.
 // On Android, it needs to be throttled because SurfaceTexture contains only one
 // (the most recent) image data.
 pref("media.video-queue.send-to-compositor-size", 1);
 
-// Allow to check if the decoder supports recycling only on Fennec nightly build.
-pref("media.decoder.recycle.enabled", true);
-
-// Enable the MediaCodec PlatformDecoderModule by default.
-pref("media.android-media-codec.enabled", true);
-pref("media.android-media-codec.preferred", true);
-
 // Enable MSE
 pref("media.mediasource.enabled", true);
 
 pref("media.mediadrm-widevinecdm.visible", true);
 
-#ifdef NIGHTLY_BUILD
-// Enable EME (Encrypted Media Extensions)
-pref("media.eme.enabled", true);
-#endif
-
-pref("media.hls.enabled", true);
-
-// Whether to suspend decoding of videos in background tabs.
-pref("media.suspend-bkgnd-video.enabled", true);
-
 // optimize images memory usage
 pref("image.downscale-during-decode.enabled", true);
 
 // The download protection UI is not implemented yet (bug 1239094).
 pref("browser.safebrowsing.downloads.enabled", false);
 
 // The application reputation lists are not available on Android.
 pref("urlclassifier.downloadAllowTable", "");
@@ -895,12 +873,10 @@ pref("dom.keyboardevent.dispatch_during_
 
 #if CPU_ARCH == aarch64
 pref("javascript.options.native_regexp", false);
 #endif
 
 // Ask for permission when enumerating WebRTC devices.
 pref("media.navigator.permission.device", true);
 
-pref("media.videocontrols.lock-video-orientation", true);
-
 // Allow system add-on updates
 pref("extensions.systemAddon.update.url", "https://aus5.mozilla.org/update/3/SystemAddons/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/update.xml");
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -73,16 +73,26 @@
 // - <default-value> is the same as for normal prefs.
 //
 // Note that Rust code must access the global variable directly, rather than via
 // the getter.
 
 // clang-format off
 
 //---------------------------------------------------------------------------
+// Accessibility prefs
+//---------------------------------------------------------------------------
+
+VARCACHE_PREF(
+  "accessibility.monoaudio.enable",
+   accessibility_monoaudio_enable,
+  bool, false
+)
+
+//---------------------------------------------------------------------------
 // Full-screen prefs
 //---------------------------------------------------------------------------
 
 #ifdef RELEASE_OR_BETA
 # define PREF_VALUE false
 #else
 # define PREF_VALUE true
 #endif
@@ -291,16 +301,507 @@ VARCACHE_PREF(
 
 VARCACHE_PREF(
   "javascript.options.mem.notify",
    javascript_options_mem_notify,
   bool, false
 )
 
 //---------------------------------------------------------------------------
+// Media prefs
+//---------------------------------------------------------------------------
+
+// These prefs use camel case instead of snake case for the getter because one
+// reviewer had an unshakeable preference for that.
+
+// File-backed MediaCache size.
+#ifdef ANDROID
+# define PREF_VALUE  32768  // Measured in KiB
+#else
+# define PREF_VALUE 512000  // Measured in KiB
+#endif
+VARCACHE_PREF(
+  "media.cache_size",
+   MediaCacheSize,
+  uint32_t, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// If a resource is known to be smaller than this size (in kilobytes), a
+// memory-backed MediaCache may be used; otherwise the (single shared global)
+// file-backed MediaCache is used.
+VARCACHE_PREF(
+  "media.memory_cache_max_size",
+   MediaMemoryCacheMaxSize,
+  uint32_t, 8192      // Measured in KiB
+)
+
+// Don't create more memory-backed MediaCaches if their combined size would go
+// above this absolute size limit.
+#ifdef ANDROID
+# define PREF_VALUE  32768    // Measured in KiB
+#else
+# define PREF_VALUE 524288    // Measured in KiB
+#endif
+VARCACHE_PREF(
+  "media.memory_caches_combined_limit_kb",
+   MediaMemoryCachesCombinedLimitKb,
+  uint32_t, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// Don't create more memory-backed MediaCaches if their combined size would go
+// above this relative size limit (a percentage of physical memory).
+VARCACHE_PREF(
+  "media.memory_caches_combined_limit_pc_sysmem",
+   MediaMemoryCachesCombinedLimitPcSysmem,
+  uint32_t, 5         // A percentage
+)
+
+// When a network connection is suspended, don't resume it until the amount of
+// buffered data falls below this threshold (in seconds).
+#ifdef ANDROID
+# define PREF_VALUE 10  // Use a smaller limit to save battery.
+#else
+# define PREF_VALUE 30
+#endif
+VARCACHE_PREF(
+  "media.cache_resume_threshold",
+   MediaCacheResumeThreshold,
+  int32_t, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// Stop reading ahead when our buffered data is this many seconds ahead of the
+// current playback position. This limit can stop us from using arbitrary
+// amounts of network bandwidth prefetching huge videos.
+#ifdef ANDROID
+# define PREF_VALUE 30  // Use a smaller limit to save battery.
+#else
+# define PREF_VALUE 60
+#endif
+VARCACHE_PREF(
+  "media.cache_readahead_limit",
+   MediaCacheReadaheadLimit,
+  int32_t, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// AudioSink
+VARCACHE_PREF(
+  "media.resampling.enabled",
+   MediaResamplingEnabled,
+  bool, false
+)
+
+#if defined(XP_WIN) || defined(XP_DARWIN) || defined(MOZ_PULSEAUDIO)
+// libcubeb backend implement .get_preferred_channel_layout
+# define PREF_VALUE false
+#else
+# define PREF_VALUE true
+#endif
+VARCACHE_PREF(
+  "media.forcestereo.enabled",
+   MediaForcestereoEnabled,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// VideoSink
+VARCACHE_PREF(
+  "media.ruin-av-sync.enabled",
+   MediaRuinAvSyncEnabled,
+  bool, false
+)
+
+// Encrypted Media Extensions
+#if defined(ANDROID)
+# if defined(NIGHTLY_BUILD)
+#  define PREF_VALUE true
+# else
+#  define PREF_VALUE false
+# endif
+#elif defined(XP_LINUX)
+  // On Linux EME is visible but disabled by default. This is so that the "Play
+  // DRM content" checkbox in the Firefox UI is unchecked by default. DRM
+  // requires downloading and installing proprietary binaries, which users on
+  // an open source operating systems didn't opt into. The first time a site
+  // using EME is encountered, the user will be prompted to enable DRM,
+  // whereupon the EME plugin binaries will be downloaded if permission is
+  // granted.
+# define PREF_VALUE false
+#else
+# define PREF_VALUE true
+#endif
+VARCACHE_PREF(
+  "media.eme.enabled",
+   MediaEmeEnabled,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+VARCACHE_PREF(
+  "media.clearkey.persistent-license.enabled",
+   MediaClearkeyPersistentLicenseEnabled,
+  bool, false
+)
+
+#if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
+// Whether to allow, on a Linux system that doesn't support the necessary
+// sandboxing features, loading Gecko Media Plugins unsandboxed.  However, EME
+// CDMs will not be loaded without sandboxing even if this pref is changed.
+VARCACHE_PREF(
+  "media.gmp.insecure.allow",
+   MediaGmpInsecureAllow,
+  bool, false
+)
+#endif
+
+// Specifies whether the PDMFactory can create a test decoder that just outputs
+// blank frames/audio instead of actually decoding. The blank decoder works on
+// all platforms.
+VARCACHE_PREF(
+  "media.use-blank-decoder",
+   MediaUseBlankDecoder,
+  bool, false
+)
+
+#if defined(XP_WIN)
+# define PREF_VALUE true
+#else
+# define PREF_VALUE false
+#endif
+VARCACHE_PREF(
+  "media.gpu-process-decoder",
+   MediaGpuProcessDecoder,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+#ifdef ANDROID
+
+// Enable the MediaCodec PlatformDecoderModule by default.
+VARCACHE_PREF(
+  "media.android-media-codec.enabled",
+   MediaAndroidMediaCodecEnabled,
+  bool, true
+)
+
+VARCACHE_PREF(
+  "media.android-media-codec.preferred",
+   MediaAndroidMediaCodecPreferred,
+  bool, true
+)
+
+#endif // ANDROID
+
+// WebRTC
+#ifdef MOZ_WEBRTC
+#ifdef ANDROID
+
+VARCACHE_PREF(
+  "media.navigator.hardware.vp8_encode.acceleration_remote_enabled",
+   MediaNavigatorHardwareVp8encodeAccelerationRemoteEnabled,
+  bool, true
+)
+
+PREF("media.navigator.hardware.vp8_encode.acceleration_enabled", bool, true)
+
+PREF("media.navigator.hardware.vp8_decode.acceleration_enabled", bool, false)
+
+#endif // ANDROID
+
+// Use MediaDataDecoder API for WebRTC. This includes hardware acceleration for
+// decoding.
+VARCACHE_PREF(
+  "media.navigator.mediadatadecoder_enabled",
+   MediaNavigatorMediadatadecoderEnabled,
+  bool, false
+)
+#endif // MOZ_WEBRTC
+
+#ifdef MOZ_FFMPEG
+
+# if defined(XP_MACOSX)
+#  define PREF_VALUE false
+# else
+#  define PREF_VALUE true
+# endif
+VARCACHE_PREF(
+  "media.ffmpeg.enabled",
+   MediaFfmpegEnabled,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+VARCACHE_PREF(
+  "media.libavcodec.allow-obsolete",
+   MediaLibavcodecAllowObsolete,
+  bool, false
+)
+
+#endif // MOZ_FFMPEG
+
+#ifdef MOZ_FFVPX
+VARCACHE_PREF(
+  "media.ffvpx.enabled",
+   MediaFfvpxEnabled,
+  bool, true
+)
+#endif
+
+#if defined(MOZ_FFMPEG) || defined(MOZ_FFVPX)
+VARCACHE_PREF(
+  "media.ffmpeg.low-latency.enabled",
+   MediaFfmpegLowLatencyEnabled,
+  bool, false
+)
+#endif
+
+#ifdef MOZ_WMF
+
+VARCACHE_PREF(
+  "media.wmf.enabled",
+   MediaWmfEnabled,
+  bool, true
+)
+
+// Whether DD should consider WMF-disabled a WMF failure, useful for testing.
+VARCACHE_PREF(
+  "media.decoder-doctor.wmf-disabled-is-failure",
+   MediaDecoderDoctorWmfDisabledIsFailure,
+  bool, false
+)
+
+VARCACHE_PREF(
+  "media.wmf.vp9.enabled",
+   MediaWmfVp9Enabled,
+  bool, true
+)
+
+#endif // MOZ_WMF
+
+// Whether to check the decoder supports recycling.
+#ifdef ANDROID
+# define PREF_VALUE true
+#else
+# define PREF_VALUE false
+#endif
+VARCACHE_PREF(
+  "media.decoder.recycle.enabled",
+   MediaDecoderRecycleEnabled,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// Should MFR try to skip to the next key frame?
+VARCACHE_PREF(
+  "media.decoder.skip-to-next-key-frame.enabled",
+   MediaDecoderSkipToNextKeyFrameEnabled,
+  bool, true
+)
+
+VARCACHE_PREF(
+  "media.gmp.decoder.enabled",
+   MediaGmpDecoderEnabled,
+  bool, false
+)
+
+VARCACHE_PREF(
+  "media.eme.audio.blank",
+   MediaEmeAudioBlank,
+  bool, false
+)
+VARCACHE_PREF(
+  "media.eme.video.blank",
+   MediaEmeVideoBlank,
+  bool, false
+)
+
+VARCACHE_PREF(
+  "media.eme.chromium-api.video-shmems",
+   MediaEmeChromiumApiVideoShmems,
+  uint32_t, 6
+)
+
+// Whether to suspend decoding of videos in background tabs.
+VARCACHE_PREF(
+  "media.suspend-bkgnd-video.enabled",
+   MediaSuspendBkgndVideoEnabled,
+  bool, true
+)
+
+// Delay, in ms, from time window goes to background to suspending
+// video decoders. Defaults to 10 seconds.
+VARCACHE_PREF(
+  "media.suspend-bkgnd-video.delay-ms",
+   MediaSuspendBkgndVideoDelayMs,
+  RelaxedAtomicUint32, 10000
+)
+
+VARCACHE_PREF(
+  "media.dormant-on-pause-timeout-ms",
+   MediaDormantOnPauseTimeoutMs,
+  int32_t, 5000
+)
+
+VARCACHE_PREF(
+  "media.webspeech.synth.force_global_queue",
+   MediaWebspeechSynthForceGlobalQueue,
+  bool, false
+)
+
+VARCACHE_PREF(
+  "media.webspeech.test.enable",
+   MediaWebspeechTestEnable,
+  bool, false
+)
+
+VARCACHE_PREF(
+  "media.webspeech.test.fake_fsm_events",
+   MediaWebspeechTextFakeFsmEvents,
+  bool, false
+)
+
+VARCACHE_PREF(
+  "media.webspeech.test.fake_recognition_service",
+   MediaWebspeechTextFakeRecognitionService,
+  bool, false
+)
+
+#ifdef MOZ_WEBSPEECH
+VARCACHE_PREF(
+  "media.webspeech.recognition.enable",
+   MediaWebspeechRecognitionEnable,
+  bool, false
+)
+#endif
+
+VARCACHE_PREF(
+  "media.webspeech.recognition.force_enable",
+   MediaWebspeechRecognitionForceEnable,
+  bool, false
+)
+
+#if defined(RELEASE_OR_BETA)
+# define PREF_VALUE 3
+#else
+  // Zero tolerance in pre-release builds to detect any decoder regression.
+# define PREF_VALUE 0
+#endif
+VARCACHE_PREF(
+  "media.audio-max-decode-error",
+   MediaAudioMaxDecodeError,
+  uint32_t, PREF_VALUE
+)
+#undef PREF_VALUE
+
+#if defined(RELEASE_OR_BETA)
+# define PREF_VALUE 2
+#else
+  // Zero tolerance in pre-release builds to detect any decoder regression.
+# define PREF_VALUE 0
+#endif
+VARCACHE_PREF(
+  "media.video-max-decode-error",
+   MediaVideoMaxDecodeError,
+  uint32_t, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// Ogg
+VARCACHE_PREF(
+  "media.ogg.enabled",
+   MediaOggEnabled,
+  bool, true
+)
+
+// AV1
+VARCACHE_PREF(
+  "media.av1.enabled",
+   MediaAv1Enabled,
+  bool, true
+)
+
+// Flac
+// Use new MediaFormatReader architecture for plain ogg.
+VARCACHE_PREF(
+  "media.ogg.flac.enabled",
+   MediaOggFlacEnabled,
+  bool, true
+)
+
+VARCACHE_PREF(
+  "media.flac.enabled",
+   MediaFlacEnabled,
+  bool, true
+)
+
+// Hls
+#ifdef ANDROID
+# define PREF_VALUE true
+#else
+# define PREF_VALUE false
+#endif
+VARCACHE_PREF(
+  "media.hls.enabled",
+   MediaHlsEnabled,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+#ifdef MOZ_FMP4
+# define PREF_VALUE true
+#else
+# define PREF_VALUE false
+#endif
+VARCACHE_PREF(
+  "media.mp4.enabled",
+   mediaMp4Enabled,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// Error/warning handling, Decoder Doctor.
+//
+// Set to true to force demux/decode warnings to be treated as errors.
+VARCACHE_PREF(
+  "media.playback.warnings-as-errors",
+   MediaPlaybackWarningsAsErrors,
+  bool, false
+)
+
+// Resume video decoding when the cursor is hovering on a background tab to
+// reduce the resume latency and improve the user experience.
+VARCACHE_PREF(
+  "media.resume-bkgnd-video-on-tabhover",
+   MediaResumeBkgndVideoOnTabhover,
+  bool, true
+)
+
+#ifdef ANDROID
+# define PREF_VALUE true
+#else
+# define PREF_VALUE false
+#endif
+VARCACHE_PREF(
+  "media.videocontrols.lock-video-orientation",
+   MediaVideocontrolsLockVideoOrientation,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// Media Seamless Looping
+VARCACHE_PREF(
+  "media.seamless-looping",
+   MediaSeamlessLooping,
+  bool, true
+)
+
+//---------------------------------------------------------------------------
 // Network prefs
 //---------------------------------------------------------------------------
 
 // Sub-resources HTTP-authentication:
 //   0 - don't allow sub-resources to open HTTP authentication credentials
 //       dialogs
 //   1 - allow sub-resources to open HTTP authentication credentials dialogs,
 //       but don't allow it for cross-origin sub-resources
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -344,40 +344,20 @@ pref("print.shrink-to-fit.scale-limit-pe
 pref("print.use_simplify_page", false);
 
 // Disable support for MathML
 pref("mathml.disabled",    false);
 
 // Enable scale transform for stretchy MathML operators. See bug 414277.
 pref("mathml.scale_stretchy_operators.enabled", true);
 
-pref("media.dormant-on-pause-timeout-ms", 5000);
-
 // Used by ChannelMediaResource to run data callbacks from HTTP channel
 // off the main thread.
 pref("media.omt_data_delivery.enabled", true);
 
-// File-backed MediaCache size in kilobytes
-pref("media.cache_size", 512000);
-// When a network connection is suspended, don't resume it until the
-// amount of buffered data falls below this threshold (in seconds).
-pref("media.cache_resume_threshold", 30);
-// Stop reading ahead when our buffered data is this many seconds ahead
-// of the current playback position. This limit can stop us from using arbitrary
-// amounts of network bandwidth prefetching huge videos.
-pref("media.cache_readahead_limit", 60);
-// If a resource is known to be smaller than this size (in kilobytes), a
-// memory-backed MediaCache may be used; otherwise the (single shared
-// global) file-backed MediaCache is used.
-pref("media.memory_cache_max_size", 8192);
-// Don't create more memory-backed MediaCaches if their combined size would go
-// above the lowest limit (in kilobytes or in percent of physical memory size).
-pref("media.memory_caches_combined_limit_kb", 524288);
-pref("media.memory_caches_combined_limit_pc_sysmem", 5);
-
 // We'll throttle the download if the download rate is throttle-factor times
 // the estimated playback rate, AND we satisfy the cache readahead_limit
 // above. The estimated playback rate is time_duration/length_in_bytes.
 // This means we'll only throttle the download if there's no concern that
 // throttling would cause us to stop and buffer.
 pref("media.throttle-factor", 2);
 // By default, we'll throttle media download once we've reached the the
 // readahead_limit if the download is fast. This pref toggles the "and the
@@ -390,65 +370,37 @@ pref("media.volume_scale", "1.0");
 
 // Whether we should play videos opened in a "video document", i.e. videos
 // opened as top-level documents, as opposed to inside a media element.
 pref("media.play-stand-alone", true);
 
 pref("media.hardware-video-decoding.enabled", true);
 pref("media.hardware-video-decoding.force-enabled", false);
 
-#ifdef MOZ_FMP4
-pref("media.mp4.enabled", true);
-// Specifies whether the PDMFactory can create a test decoder that
-#endif
-// just outputs blank frames/audio instead of actually decoding. The blank
-// decoder works on all platforms.
-pref("media.use-blank-decoder", false);
 #ifdef MOZ_WMF
-pref("media.wmf.enabled", true);
 pref("media.wmf.dxva.enabled", true);
 pref("media.wmf.dxva.d3d11.enabled", true);
 pref("media.wmf.dxva.max-videos", 8);
 pref("media.wmf.low-latency.enabled", false);
-pref("media.wmf.skip-blacklist", false);
-pref("media.wmf.vp9.enabled", true);
 pref("media.wmf.amd.vp9.enabled", true);
 pref("media.wmf.amd.highres.enabled", true);
 pref("media.wmf.allow-unsupported-resolutions", false);
 pref("media.wmf.use-nv12-format", true);
 pref("media.wmf.disable-d3d11-for-dlls", "igd11dxva64.dll: 20.19.15.4463, 20.19.15.4454, 20.19.15.4444, 20.19.15.4416, 20.19.15.4404, 20.19.15.4390, 20.19.15.4380, 20.19.15.4377, 20.19.15.4364, 20.19.15.4360, 20.19.15.4352, 20.19.15.4331, 20.19.15.4326, 20.19.15.4300; igd10iumd32.dll: 20.19.15.4444, 20.19.15.4424, 20.19.15.4409, 20.19.15.4390, 20.19.15.4380, 20.19.15.4360, 10.18.10.4358, 20.19.15.4331, 20.19.15.4312, 20.19.15.4300, 10.18.15.4281, 10.18.15.4279, 10.18.10.4276, 10.18.15.4268, 10.18.15.4256, 10.18.10.4252, 10.18.15.4248, 10.18.14.4112, 10.18.10.3958, 10.18.10.3496, 10.18.10.3431, 10.18.10.3412, 10.18.10.3355, 9.18.10.3234, 9.18.10.3071, 9.18.10.3055, 9.18.10.3006; igd10umd32.dll: 9.17.10.4229, 9.17.10.3040, 9.17.10.2884, 9.17.10.2857, 8.15.10.2274, 8.15.10.2272, 8.15.10.2246, 8.15.10.1840, 8.15.10.1808; igd10umd64.dll: 9.17.10.4229, 9.17.10.2884, 9.17.10.2857, 10.18.10.3496; isonyvideoprocessor.dll: 4.1.2247.8090, 4.1.2153.6200; tosqep.dll: 1.2.15.526, 1.1.12.201, 1.0.11.318, 1.0.11.215, 1.0.10.1224; tosqep64.dll: 1.1.12.201, 1.0.11.215; nvwgf2um.dll: 22.21.13.8253, 22.21.13.8233, 22.21.13.8205, 22.21.13.8189, 22.21.13.8178, 22.21.13.8165, 21.21.13.7892, 21.21.13.7878, 21.21.13.7866, 21.21.13.7849, 21.21.13.7654, 21.21.13.7653, 21.21.13.7633, 21.21.13.7619, 21.21.13.7563, 21.21.13.7306, 21.21.13.7290, 21.21.13.7270, 21.21.13.7254, 21.21.13.6939, 21.21.13.6926, 21.21.13.6909, 21.21.13.4201, 21.21.13.4200, 10.18.13.6881, 10.18.13.6839, 10.18.13.6510, 10.18.13.6472, 10.18.13.6143, 10.18.13.5946, 10.18.13.5923, 10.18.13.5921, 10.18.13.5891, 10.18.13.5887, 10.18.13.5582, 10.18.13.5445, 10.18.13.5382, 10.18.13.5362, 9.18.13.4788, 9.18.13.4752, 9.18.13.4725, 9.18.13.4709, 9.18.13.4195, 9.18.13.4192, 9.18.13.4144, 9.18.13.4052, 9.18.13.3788, 9.18.13.3523, 9.18.13.3235, 9.18.13.3165, 9.18.13.2723, 9.18.13.2702, 9.18.13.1422, 9.18.13.1407, 9.18.13.1106, 9.18.13.546; atidxx32.dll: 21.19.151.3, 21.19.142.257, 21.19.137.514, 21.19.137.1, 21.19.134.1, 21.19.128.7, 21.19.128.4, 20.19.0.32837, 20.19.0.32832, 8.17.10.682, 8.17.10.671, 8.17.10.661, 8.17.10.648, 8.17.10.644, 8.17.10.625, 8.17.10.605, 8.17.10.581, 8.17.10.569, 8.17.10.560, 8.17.10.545, 8.17.10.539, 8.17.10.531, 8.17.10.525, 8.17.10.520, 8.17.10.519, 8.17.10.514, 8.17.10.511, 8.17.10.494, 8.17.10.489, 8.17.10.483, 8.17.10.453, 8.17.10.451, 8.17.10.441, 8.17.10.436, 8.17.10.432, 8.17.10.425, 8.17.10.418, 8.17.10.414, 8.17.10.401, 8.17.10.395, 8.17.10.385, 8.17.10.378, 8.17.10.362, 8.17.10.355, 8.17.10.342, 8.17.10.331, 8.17.10.318, 8.17.10.310, 8.17.10.286, 8.17.10.269, 8.17.10.261, 8.17.10.247, 8.17.10.240, 8.15.10.212; atidxx64.dll: 21.19.151.3, 21.19.142.257, 21.19.137.514, 21.19.137.1, 21.19.134.1, 21.19.128.7, 21.19.128.4, 20.19.0.32832, 8.17.10.682, 8.17.10.661, 8.17.10.644, 8.17.10.625; nvumdshim.dll: 10.18.13.6822");
 pref("media.wmf.disable-d3d9-for-dlls", "igdumd64.dll: 8.15.10.2189, 8.15.10.2119, 8.15.10.2104, 8.15.10.2102, 8.771.1.0; atiumd64.dll: 7.14.10.833, 7.14.10.867, 7.14.10.885, 7.14.10.903, 7.14.10.911, 8.14.10.768, 9.14.10.1001, 9.14.10.1017, 9.14.10.1080, 9.14.10.1128, 9.14.10.1162, 9.14.10.1171, 9.14.10.1183, 9.14.10.1197, 9.14.10.945, 9.14.10.972, 9.14.10.984, 9.14.10.996");
 pref("media.wmf.deblacklisting-for-telemetry-in-gpu-process", true);
 pref("media.wmf.play-stand-alone", true);
 pref("media.wmf.use-sync-texture", true);
 #endif
-#if defined(MOZ_FFMPEG)
-#if defined(XP_MACOSX)
-pref("media.ffmpeg.enabled", false);
-#else
-pref("media.ffmpeg.enabled", true);
-#endif
-pref("media.libavcodec.allow-obsolete", false);
-#endif
-#if defined(MOZ_FFVPX)
-pref("media.ffvpx.enabled", true);
-#endif
-#if defined(MOZ_FFMPEG) || defined(MOZ_FFVPX)
-pref("media.ffmpeg.low-latency.enabled", false);
-#endif
-pref("media.gmp.decoder.enabled", false);
 pref("media.gmp.decoder.aac", 0);
 pref("media.gmp.decoder.h264", 0);
-pref("media.ogg.enabled", true);
 pref("media.opus.enabled", true);
 pref("media.wave.enabled", true);
 pref("media.webm.enabled", true);
 
-pref("media.eme.chromium-api.video-shmems", 6);
-
 // GMP storage version number. At startup we check the version against
 // media.gmp.storage.version.observed, and if the versions don't match,
 // we clear storage and set media.gmp.storage.version.observed=expected.
 // This provides a mechanism to clear GMP storage when non-compatible
 // changes are made.
 pref("media.gmp.storage.version.expected", 1);
 
 // Filter what triggers user notifications.
@@ -457,33 +409,19 @@ pref("media.gmp.storage.version.expected
 pref("media.decoder-doctor.notifications-allowed", "MediaWMFNeeded,MediaWidevineNoWMF,MediaCannotInitializePulseAudio,MediaCannotPlayNoDecoders,MediaUnsupportedLibavcodec,MediaDecodeError");
 #else
 pref("media.decoder-doctor.notifications-allowed", "MediaWMFNeeded,MediaWidevineNoWMF,MediaCannotInitializePulseAudio,MediaCannotPlayNoDecoders,MediaUnsupportedLibavcodec");
 #endif
 pref("media.decoder-doctor.decode-errors-allowed", "");
 pref("media.decoder-doctor.decode-warnings-allowed", "");
 // Whether we report partial failures.
 pref("media.decoder-doctor.verbose", false);
-// Whether DD should consider WMF-disabled a WMF failure, useful for testing.
-pref("media.decoder-doctor.wmf-disabled-is-failure", false);
 // URL to report decode issues
 pref("media.decoder-doctor.new-issue-endpoint", "https://webcompat.com/issues/new");
 
-// Whether to suspend decoding of videos in background tabs.
-pref("media.suspend-bkgnd-video.enabled", true);
-// Delay, in ms, from time window goes to background to suspending
-// video decoders. Defaults to 10 seconds.
-pref("media.suspend-bkgnd-video.delay-ms", 10000);
-// Resume video decoding when the cursor is hovering on a background tab to
-// reduce the resume latency and improve the user experience.
-pref("media.resume-bkgnd-video-on-tabhover", true);
-
-// Whether to enable media seamless looping.
-pref("media.seamless-looping", true);
-
 #ifdef MOZ_WEBRTC
 pref("media.navigator.enabled", true);
 pref("media.navigator.video.enabled", true);
 pref("media.navigator.video.default_fps",30);
 pref("media.navigator.video.use_remb", true);
 pref("media.navigator.video.use_tmmbr", false);
 pref("media.navigator.audio.use_fec", true);
 pref("media.navigator.video.red_ulpfec_enabled", false);
@@ -566,25 +504,19 @@ pref("media.getusermedia.agc", 3); // kA
 // full_duplex: enable cubeb full-duplex capture/playback
 pref("media.navigator.audio.full_duplex", true);
 #if defined(XP_MACOSX)
 pref("media.peerconnection.capture_delay", 50);
 #elif defined(XP_WIN)
 pref("media.peerconnection.capture_delay", 50);
 #elif defined(ANDROID)
 pref("media.peerconnection.capture_delay", 100);
-pref("media.navigator.hardware.vp8_encode.acceleration_enabled", true);
-pref("media.navigator.hardware.vp8_encode.acceleration_remote_enabled", true);
-pref("media.navigator.hardware.vp8_decode.acceleration_enabled", false);
 #else
 pref("media.peerconnection.capture_delay", 70);
 #endif
-// Use MediaDataDecoder API for WebRTC, this includes hardware acceleration for
-// decoding.
-pref("media.navigator.mediadatadecoder_enabled", false);
 #endif
 
 pref("dom.webaudio.enabled", true);
 
 // Exposes the navigator.webdriver attribute.
 pref("dom.webdriver.enabled", true);
 
 #if !defined(ANDROID)
@@ -609,28 +541,21 @@ pref("media.mediasource.mp4.enabled", tr
 
 #if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_ANDROID)
 pref("media.mediasource.webm.enabled", false);
 #else
 pref("media.mediasource.webm.enabled", true);
 #endif
 pref("media.mediasource.webm.audio.enabled", true);
 
-pref("media.av1.enabled", false);
-
-// Use new MediaFormatReader architecture for plain ogg.
-pref("media.flac.enabled", true);
-pref("media.ogg.flac.enabled", true);
-
 pref("media.benchmark.vp9.threshold", 150);
 pref("media.benchmark.frames", 300);
 pref("media.benchmark.timeout", 1000);
 
 #ifdef MOZ_WEBSPEECH
-pref("media.webspeech.recognition.enable", false);
 pref("media.webspeech.synth.enabled", false);
 #endif
 #ifdef MOZ_WEBM_ENCODER
 pref("media.encoder.webm.enabled", true);
 #endif
 
 // Whether to allow recording of AudioNodes with MediaRecorder
 pref("media.recorder.audio_node.enabled", false);
@@ -655,41 +580,32 @@ pref("media.video-queue.default-size", 1
 
 // The maximum number of queued frames to send to the compositor.
 // By default, send all of them.
 pref("media.video-queue.send-to-compositor-size", 9999);
 
 // Whether to disable the video stats to prevent fingerprinting
 pref("media.video_stats.enabled", true);
 
-// Whether to check the decoder supports recycling.
-pref("media.decoder.recycle.enabled", false);
-
-//Weather MFR should try to skip to next key frame or not.
-pref("media.decoder.skip-to-next-key-frame.enabled", true);
-
 // Log level for cubeb, the audio input/output system. Valid values are
 // "verbose", "normal" and "" (log disabled).
 pref("media.cubeb.logging_level", "");
 
 // Cubeb sandbox (remoting) control
 #ifdef XP_LINUX
 pref("media.cubeb.sandbox", true);
 pref("media.audioipc.pool_size", 2);
 // 64 kB stack per pool thread.
 pref("media.audioipc.stack_size", 65536);
 #else
 pref("media.cubeb.sandbox", false);
 #endif
 
 pref("media.webaudio.audiocontextoptions-samplerate.enabled", true);
 
-// Set to true to force demux/decode warnings to be treated as errors.
-pref("media.playback.warnings-as-errors", false);
-
 // Weather we allow AMD switchable graphics
 pref("layers.amd-switchable-gfx.enabled", true);
 
 // Whether to use async panning and zooming
 pref("layers.async-pan-zoom.enabled", true);
 
 // Whether to enable event region building during painting
 pref("layout.event-regions.enabled", false);
@@ -4804,17 +4720,16 @@ pref("network.tcp.tcp_fastopen_http_stal
 // Whether to disable acceleration for all widgets.
 pref("layers.acceleration.disabled", false);
 // Preference that when switched at runtime will run a series of benchmarks
 // and output the result to stderr.
 pref("layers.bench.enabled", false);
 
 #if defined(XP_WIN)
 pref("layers.gpu-process.enabled", true);
-pref("media.gpu-process-decoder", true);
 pref("layers.gpu-process.allow-software", true);
 #ifdef NIGHTLY_BUILD
 pref("layers.gpu-process.max_restarts", 3);
 #endif
 #endif
 
 // Whether to force acceleration on, ignoring blacklists.
 #ifdef ANDROID
@@ -5692,23 +5607,16 @@ pref("narrate.enabled", false);
 #endif
 
 pref("narrate.test", false);
 pref("narrate.rate", 0);
 pref("narrate.voice", " { \"default\": \"automatic\" }");
 // Only make voices that match content language available.
 pref("narrate.filter-voices", true);
 
-#if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
-// Whether to allow, on a Linux system that doesn't support the necessary sandboxing
-// features, loading Gecko Media Plugins unsandboxed.  However, EME CDMs will not be
-// loaded without sandboxing even if this pref is changed.
-pref("media.gmp.insecure.allow", false);
-#endif
-
 // HTML <dialog> element
 pref("dom.dialog_element.enabled", false);
 
 // Allow control characters appear in composition string.
 // When this is false, control characters except
 // CHARACTER TABULATION (horizontal tab) are removed from
 // both composition string and data attribute of compositionupdate
 // and compositionend events.
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -27,17 +27,16 @@
 #include "nsIXULAppInfo.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/GPUProcessManager.h"
 #include "mozilla/gfx/Logging.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/layers/PaintThread.h"
-#include "MediaPrefs.h"
 #include "gfxPrefs.h"
 #include "gfxPlatform.h"
 #include "gfxConfig.h"
 #include "DriverCrashGuard.h"
 
 using namespace mozilla::widget;
 using namespace mozilla;
 using mozilla::MutexAutoLock;
@@ -593,20 +592,16 @@ GfxInfoBase::~GfxInfoBase()
 {
 }
 
 nsresult
 GfxInfoBase::Init()
 {
   InitGfxDriverInfoShutdownObserver();
   gfxPrefs::GetSingleton();
-  if (!XRE_IsGPUProcess()) {
-    // MediaPrefs can't run in the GPU process.
-    MediaPrefs::GetSingleton();
-  }
 
   nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
   if (os) {
     os->AddObserver(this, "blocklist-data-gfxItems", true);
   }
 
   return NS_OK;
 }
--- a/widget/android/AndroidBridge.cpp
+++ b/widget/android/AndroidBridge.cpp
@@ -43,17 +43,16 @@
 #include "SurfaceTexture.h"
 #include "GLContextProvider.h"
 
 #include "mozilla/TimeStamp.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/dom/ContentChild.h"
 #include "nsIObserverService.h"
 #include "nsISupportsPrimitives.h"
-#include "MediaPrefs.h"
 #include "WidgetUtils.h"
 
 #include "FennecJNIWrappers.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 using namespace mozilla::java;
 
@@ -125,18 +124,16 @@ AndroidBridge::ConstructBridge()
      * linker lock still held.  This results in a deadlock when trying
      * to call dlclose() while we're already inside dlclose().
      * Conveniently, NSS has an env var that can prevent it from unloading.
      */
     putenv(const_cast<char*>("NSS_DISABLE_UNLOAD=1"));
 
     MOZ_ASSERT(!sBridge);
     sBridge = new AndroidBridge();
-
-    MediaPrefs::GetSingleton();
 }
 
 void
 AndroidBridge::DeconstructBridge()
 {
     if (sBridge) {
         delete sBridge;
         // AndroidBridge destruction requires sBridge to still be valid,