tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

goog_cc_factory.cc (1721B)


      1 /*
      2 *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
      3 *
      4 *  Use of this source code is governed by a BSD-style license
      5 *  that can be found in the LICENSE file in the root of the source
      6 *  tree. An additional intellectual property rights grant can be found
      7 *  in the file PATENTS.  All contributing project authors may
      8 *  be found in the AUTHORS file in the root of the source tree.
      9 */
     10 
     11 #include "api/transport/goog_cc_factory.h"
     12 
     13 #include <cstdint>
     14 #include <memory>
     15 #include <utility>
     16 
     17 #include "api/transport/network_control.h"
     18 #include "api/units/time_delta.h"
     19 #include "modules/congestion_controller/goog_cc/goog_cc_network_control.h"
     20 
     21 namespace webrtc {
     22 
     23 GoogCcNetworkControllerFactory::GoogCcNetworkControllerFactory(
     24    GoogCcFactoryConfig config)
     25    : factory_config_(std::move(config)) {}
     26 
     27 std::unique_ptr<NetworkControllerInterface>
     28 GoogCcNetworkControllerFactory::Create(NetworkControllerConfig config) {
     29  GoogCcConfig goog_cc_config;
     30  if (factory_config_.network_state_estimator_factory) {
     31    goog_cc_config.network_state_estimator =
     32        factory_config_.network_state_estimator_factory->Create(
     33            &config.env.field_trials());
     34  }
     35  if (factory_config_.network_state_predictor_factory) {
     36    goog_cc_config.network_state_predictor =
     37        factory_config_.network_state_predictor_factory
     38            ->CreateNetworkStatePredictor();
     39  }
     40  return std::make_unique<GoogCcNetworkController>(config,
     41                                                   std::move(goog_cc_config));
     42 }
     43 
     44 TimeDelta GoogCcNetworkControllerFactory::GetProcessInterval() const {
     45  const int64_t kUpdateIntervalMs = 25;
     46  return TimeDelta::Millis(kUpdateIntervalMs);
     47 }
     48 
     49 }  // namespace webrtc