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

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

mercurial