Bug 902000 - Make the load adaption depend on a pref. r=jesup
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Tue, 29 Oct 2013 15:00:28 +0100
changeset 167450 c9c43d1a6b316210670b2e1062c08c1b0ecef612
parent 167449 6fe45de47dadf4e03aa30424876259fce6fe841d
child 167451 7a170048638802e7c632426daf9afbbe74b1b8a3
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs902000
milestone28.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 902000 - Make the load adaption depend on a pref. r=jesup
content/media/webrtc/LoadMonitor.cpp
modules/libpref/src/init/all.js
--- a/content/media/webrtc/LoadMonitor.cpp
+++ b/content/media/webrtc/LoadMonitor.cpp
@@ -16,16 +16,17 @@
 #include "nsNetUtil.h"
 #include "nsILineInputStream.h"
 #include "nsIObserverService.h"
 #include "nsIServiceManager.h"
 
 #include "mozilla/TimeStamp.h"
 #include "mozilla/Util.h"
 #include "mozilla/Services.h"
+#include "mozilla/Preferences.h"
 
 #if defined(ANDROID) || defined(LINUX) || defined(XP_MACOSX)
 #include <sys/time.h>
 #include <sys/resource.h>
 #endif
 
 // NSPR_LOG_MODULES=LoadMonitor:5
 PRLogModuleInfo *gLoadMonitorLog = nullptr;
@@ -317,16 +318,20 @@ LoadMonitor::GetSystemLoad() {
   MutexAutoLock lock(mLock);
   float load = mSystemLoad;
   return load;
 }
 
 nsresult
 LoadMonitor::Init(nsRefPtr<LoadMonitor> &self)
 {
+  if (!Preferences::GetBool("media.navigator.load_adapt", false)) {
+    return NS_OK;
+  }
+
 #if defined(PR_LOGGING)
   if (!gLoadMonitorLog)
     gLoadMonitorLog = PR_NewLogModule("LoadMonitor");
   LOG(("Initializing LoadMonitor"));
 #endif
 
 #if defined(ANDROID) || defined(LINUX)
   nsRefPtr<LoadMonitorAddObserver> addObsRunner = new LoadMonitorAddObserver(self);
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -227,16 +227,17 @@ pref("media.apple.mp3.enabled", true);
 #ifdef MOZ_WEBRTC
 pref("media.navigator.enabled", true);
 pref("media.navigator.video.default_width",640);
 pref("media.navigator.video.default_height",480);
 pref("media.navigator.video.default_fps",30);
 pref("media.navigator.video.default_minfps",10);
 pref("media.navigator.video.max_fs", 0); // unrestricted
 pref("media.navigator.video.max_fr", 0); // unrestricted
+pref("media.navigator.load_adapt", false);
 pref("media.peerconnection.enabled", true);
 pref("media.navigator.permission.disabled", false);
 pref("media.peerconnection.default_iceservers", "[{\"url\": \"stun:stun.services.mozilla.com\"}]");
 pref("media.peerconnection.trickle_ice", true);
 pref("media.peerconnection.use_document_iceservers", true);
 // These values (aec, agc, and noice) are from media/webrtc/trunk/webrtc/common_types.h
 // kXxxUnchanged = 0, kXxxDefault = 1, and higher values are specific to each 
 // setting (for Xxx = Ec, Agc, or Ns).  Defaults are all set to kXxxDefault here.