tor-browser

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

network_state_predictor.h (1667B)


      1 /*
      2 *  Copyright (c) 2019 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 #ifndef API_NETWORK_STATE_PREDICTOR_H_
     12 #define API_NETWORK_STATE_PREDICTOR_H_
     13 
     14 #include <cstdint>
     15 #include <memory>
     16 
     17 #include "api/transport/bandwidth_usage.h"
     18 
     19 namespace webrtc {
     20 
     21 // TODO(yinwa): work in progress. API in class NetworkStatePredictor should not
     22 // be used by other users until this comment is removed.
     23 
     24 // NetworkStatePredictor predict network state based on current network metrics.
     25 // Usage:
     26 // Setup by calling Initialize.
     27 // For each update, call Update. Update returns network state
     28 // prediction.
     29 class NetworkStatePredictor {
     30 public:
     31  virtual ~NetworkStatePredictor() {}
     32 
     33  // Returns current network state prediction.
     34  // Inputs:  send_time_ms - packet send time.
     35  //          arrival_time_ms - packet arrival time.
     36  //          network_state - computed network state.
     37  virtual BandwidthUsage Update(int64_t send_time_ms,
     38                                int64_t arrival_time_ms,
     39                                BandwidthUsage network_state) = 0;
     40 };
     41 
     42 class NetworkStatePredictorFactoryInterface {
     43 public:
     44  virtual std::unique_ptr<NetworkStatePredictor>
     45  CreateNetworkStatePredictor() = 0;
     46  virtual ~NetworkStatePredictorFactoryInterface() = default;
     47 };
     48 
     49 }  // namespace webrtc
     50 
     51 #endif  // API_NETWORK_STATE_PREDICTOR_H_