From 48defae10240b68cd6525b461458813da2eb7f93 Mon Sep 17 00:00:00 2001 From: JW Wang Date: Tue, 24 Oct 2017 10:13:30 +0800 Subject: [PATCH] Bug 1411805 - Update() needs to read some prefs off the main thread. r=gerald MediaPrefs is our friend. MozReview-Commit-ID: 3lz5oqUR9R9 --HG-- extra : rebase_source : 31efaf14c29182b00451705b189772aac23acd34 extra : source : 7e9c68fd5fa241fc1d015b352935c2efd0daa1e8 --- dom/media/MediaCache.cpp | 4 ++-- dom/media/MediaPrefs.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dom/media/MediaCache.cpp b/dom/media/MediaCache.cpp index 17931ae4871d..06cb1aae7bed 100644 --- a/dom/media/MediaCache.cpp +++ b/dom/media/MediaCache.cpp @@ -1306,8 +1306,8 @@ MediaCache::Update() } } - int32_t resumeThreshold = Preferences::GetInt("media.cache_resume_threshold", 10); - int32_t readaheadLimit = Preferences::GetInt("media.cache_readahead_limit", 30); + int32_t resumeThreshold = MediaPrefs::MediaCacheResumeThreshold(); + int32_t readaheadLimit = MediaPrefs::MediaCacheReadaheadLimit(); for (uint32_t i = 0; i < mStreams.Length(); ++i) { actions.AppendElement(StreamAction{}); diff --git a/dom/media/MediaPrefs.h b/dom/media/MediaPrefs.h index 97d9d80f116c..0a6e0be8528e 100644 --- a/dom/media/MediaPrefs.h +++ b/dom/media/MediaPrefs.h @@ -94,6 +94,9 @@ private: MediaMemoryCachesCombinedLimitPcSysmem, uint32_t, 5); DECL_MEDIA_PREF("media.cache.resource-index", MediaResourceIndexCache, uint32_t, 8192); + 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);