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_INCOMING_BITRATE_ESTIMATOR_H_ | |
12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_INCOMING_BITRATE_ESTIMATOR_H_ | |
13 | |
14 #include "webrtc/base/optional.h" | |
15 | |
16 namespace webrtc { | |
17 | |
18 // Computes a bayesian estimate of the throughput given acks containing | |
19 // the arrival time and payload size. Samples which are far from the current | |
20 // estimate or are based on few packets are given a smaller weight, as they | |
21 // are considered to be more likely to have been caused by, e.g., delay spikes | |
22 // unrelated to congestion. | |
23 class IncomingBitrateEstimator { | |
terelius
2017/06/01 15:15:04
I'd prefer not calling it incoming bitrate, since
tschumi
2017/06/02 11:48:44
Acknowledged.
| |
24 public: | |
25 IncomingBitrateEstimator(); | |
26 void Update(int64_t now_ms, int bytes); | |
27 rtc::Optional<uint32_t> bitrate_bps() const; | |
28 | |
29 private: | |
30 float UpdateWindow(int64_t now_ms, int bytes, int rate_window_ms); | |
31 int sum_; | |
32 int64_t current_win_ms_; | |
33 int64_t prev_time_ms_; | |
34 float bitrate_estimate_; | |
35 float bitrate_estimate_var_; | |
36 }; | |
37 | |
38 } // namespace webrtc | |
39 | |
40 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCOMING_BITRATE_ESTIMATOR_H_ | |
OLD | NEW |