OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2017 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 WEBRTC_MODULES_CONGESTION_CONTROLLER_ACKNOWLEDGE_BITRATE_ESTIMATOR_H_ |
| 12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_ACKNOWLEDGE_BITRATE_ESTIMATOR_H_ |
| 13 |
| 14 #include <vector> |
| 15 |
| 16 #include "webrtc/base/optional.h" |
| 17 |
| 18 namespace webrtc { |
| 19 |
| 20 struct PacketFeedback; |
| 21 |
| 22 // Computes a bayesian estimate of the throughput given acks containing |
| 23 // the arrival time and payload size. Samples which are far from the current |
| 24 // estimate or are based on few packets are given a smaller weight, as they |
| 25 // are considered to be more likely to have been caused by, e.g., delay spikes |
| 26 // unrelated to congestion. |
| 27 class AcknowledgedBitrateEstimator { |
| 28 public: |
| 29 AcknowledgedBitrateEstimator(); |
| 30 |
| 31 void IncomingPacketFeedbackVector( |
| 32 const std::vector<PacketFeedback>& packet_feedback_vector); |
| 33 rtc::Optional<uint32_t> bitrate_bps() const; |
| 34 |
| 35 private: |
| 36 void Update(int64_t now_ms, int bytes); |
| 37 float UpdateWindow(int64_t now_ms, int bytes, int rate_window_ms); |
| 38 |
| 39 int sum_; |
| 40 int64_t current_win_ms_; |
| 41 int64_t prev_time_ms_; |
| 42 float bitrate_estimate_; |
| 43 float bitrate_estimate_var_; |
| 44 }; |
| 45 |
| 46 } // namespace webrtc |
| 47 |
| 48 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_ACKNOWLEDGE_BITRATE_ESTIMATOR_H_ |
OLD | NEW |