Bug 1271490: Use MediaPrefs to read preferences. r?cpearce
MozReview-Commit-ID: Ak5mUfGA4kc
--- 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