Bug 1482197 - P2. Make IsWebMEncoderEnabled usable off the main thread. r=bryce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 09 Aug 2018 21:22:20 +0200
changeset 486125 b472c4e49ac66a7a86aef2ef0520a1d5e6698ee4
parent 486124 aea50d33724cf43f19cc81f8c6de668ec7016f66
child 486126 bb3e357f21b456c90f9055f10c95a22fd54257a7
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbryce
bugs1482197
milestone63.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 1482197 - P2. Make IsWebMEncoderEnabled usable off the main thread. r=bryce It can be called on a worker. Depends on D3054 Differential Revision: https://phabricator.services.mozilla.com/D3055
dom/media/encoder/MediaEncoder.cpp
modules/libpref/init/StaticPrefList.h
--- a/dom/media/encoder/MediaEncoder.cpp
+++ b/dom/media/encoder/MediaEncoder.cpp
@@ -14,16 +14,17 @@
 #include "mozilla/dom/AudioNode.h"
 #include "mozilla/dom/AudioStreamTrack.h"
 #include "mozilla/dom/MediaStreamTrack.h"
 #include "mozilla/dom/VideoStreamTrack.h"
 #include "mozilla/gfx/Point.h" // IntSize
 #include "mozilla/Logging.h"
 #include "mozilla/media/MediaUtils.h"
 #include "mozilla/Preferences.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/TaskQueue.h"
 #include "mozilla/Unused.h"
 #include "nsIPrincipal.h"
 #include "nsMimeTypes.h"
 #include "OggWriter.h"
 #include "OpusTrackEncoder.h"
 #include "TimeUnits.h"
@@ -1052,17 +1053,17 @@ MediaEncoder::Stop()
     RemoveMediaStreamTrack(mVideoTrack);
   }
 }
 
 #ifdef MOZ_WEBM_ENCODER
 bool
 MediaEncoder::IsWebMEncoderEnabled()
 {
-  return Preferences::GetBool("media.encoder.webm.enabled");
+  return StaticPrefs::MediaEncoderWebMEnabled();
 }
 #endif
 
 void
 MediaEncoder::NotifyInitialized()
 {
   MOZ_ASSERT(mEncoderThread->IsCurrentThreadIn());
 
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -862,16 +862,28 @@ VARCACHE_PREF(
 #endif
 
 VARCACHE_PREF(
   "media.webspeech.recognition.force_enable",
    MediaWebspeechRecognitionForceEnable,
   bool, false
 )
 
+#if defined(MOZ_WEBM_ENCODER)
+# define PREF_VALUE true
+#else
+# define PREF_VALUE false
+#endif
+VARCACHE_PREF(
+  "media.encoder.webm.enabled",
+   MediaEncoderWebMEnabled,
+  RelaxedAtomicBool, true
+)
+#undef PREF_VALUE
+
 #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",