Bug 1271490: Use MediaPrefs to read preferences. r?cpearce draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 10 May 2016 11:27:05 +1000
changeset 366256 6a3d6fc3872c2a091978192628d9c51301c12bee
parent 366228 9b3b27524046c48d17ee43a9ab471620f6847f5b
child 366279 f2aa7fea1630ea167dc8aa4c2a548dddba448e23
push id17939
push userbmo:jyavenard@mozilla.com
push dateThu, 12 May 2016 09:31:39 +0000
reviewerscpearce
bugs1271490
milestone49.0a1
Bug 1271490: Use MediaPrefs to read preferences. r?cpearce MozReview-Commit-ID: Ak5mUfGA4kc
dom/media/MediaPrefs.h
dom/media/VideoUtils.cpp
--- a/dom/media/MediaPrefs.h
+++ b/dom/media/MediaPrefs.h
@@ -106,16 +106,18 @@ private:
   // 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);
 
+  DECL_MEDIA_PREF("media.num-decode-threads",                 MediaThreadPoolDefaultCount, uint32_t, 4);
+
 public:
   // Manage the singleton:
   static MediaPrefs& GetSingleton();
   static bool SingletonExists();
 
 private:
   template<class T> friend class StaticAutoPtr;
   static StaticAutoPtr<MediaPrefs> sInstance;
--- a/dom/media/VideoUtils.cpp
+++ b/dom/media/VideoUtils.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 "VideoUtils.h"
 
-#include "mozilla/Preferences.h"
 #include "mozilla/Base64.h"
 #include "mozilla/TaskQueue.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/Function.h"
 
+#include "MediaPrefs.h"
 #include "MediaResource.h"
 #include "TimeUnits.h"
 #include "nsMathUtils.h"
 #include "nsSize.h"
 #include "VorbisUtils.h"
 #include "ImageContainer.h"
 #include "mozilla/SharedThreadPool.h"
 #include "nsIRandomGenerator.h"
@@ -199,18 +199,17 @@ already_AddRefed<SharedThreadPool> GetMe
       break;
     default:
       MOZ_FALLTHROUGH_ASSERT("Unexpected MediaThreadType");
     case MediaThreadType::PLAYBACK:
       name = "MediaPlayback";
       break;
   }
   return SharedThreadPool::
-    Get(nsDependentCString(name),
-        Preferences::GetUint("media.num-decode-threads", 4));
+    Get(nsDependentCString(name), MediaPrefs::MediaThreadPoolDefaultCount());
 }
 
 bool
 ExtractH264CodecDetails(const nsAString& aCodec,
                         int16_t& aProfile,
                         int16_t& aLevel)
 {
   // H.264 codecs parameters have a type defined as avcN.PPCCLL, where