content/media/webrtc/LoadManagerFactory.cpp

Fri, 16 Jan 2015 04:50:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 04:50:19 +0100
branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
permissions
-rw-r--r--

Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32

michael@0 1 /* -*- Mode: C++; tab-width: 50; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "LoadManager.h"
michael@0 7 #include "LoadManagerFactory.h"
michael@0 8 #include "MainThreadUtils.h"
michael@0 9
michael@0 10 #include "mozilla/Preferences.h"
michael@0 11
michael@0 12 namespace mozilla {
michael@0 13
michael@0 14 LoadManager* LoadManagerBuild(void)
michael@0 15 {
michael@0 16 MOZ_ASSERT(NS_IsMainThread());
michael@0 17
michael@0 18 #if defined(ANDROID) || defined(LINUX)
michael@0 19 int loadMeasurementInterval =
michael@0 20 mozilla::Preferences::GetInt("media.navigator.load_adapt.measure_interval", 1000);
michael@0 21 int averagingSeconds =
michael@0 22 mozilla::Preferences::GetInt("media.navigator.load_adapt.avg_seconds", 3);
michael@0 23 float highLoadThreshold =
michael@0 24 mozilla::Preferences::GetFloat("media.navigator.load_adapt.high_load", 0.90);
michael@0 25 float lowLoadThreshold =
michael@0 26 mozilla::Preferences::GetFloat("media.navigator.load_adapt.low_load", 0.40);
michael@0 27
michael@0 28 return new LoadManager(loadMeasurementInterval,
michael@0 29 averagingSeconds,
michael@0 30 highLoadThreshold,
michael@0 31 lowLoadThreshold);
michael@0 32 #else
michael@0 33 // LoadManager not implemented on this platform.
michael@0 34 return nullptr;
michael@0 35 #endif
michael@0 36 }
michael@0 37
michael@0 38 void LoadManagerDestroy(mozilla::LoadManager* aLoadManager)
michael@0 39 {
michael@0 40 delete aLoadManager;
michael@0 41 }
michael@0 42
michael@0 43 }; // namespace

mercurial