OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_TRENDLINE_ESTIMATOR_H_ | 10 #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_TRENDLINE_ESTIMATOR_H_ |
(...skipping 15 matching lines...) Expand all Loading... | |
26 // comparison to the old threshold. Once the old estimator has been removed | 26 // comparison to the old threshold. Once the old estimator has been removed |
27 // (or the thresholds been merged into the estimators), we can just set the | 27 // (or the thresholds been merged into the estimators), we can just set the |
28 // threshold instead of setting a gain. | 28 // threshold instead of setting a gain. |
29 TrendlineEstimator(size_t window_size, | 29 TrendlineEstimator(size_t window_size, |
30 double smoothing_coef, | 30 double smoothing_coef, |
31 double threshold_gain); | 31 double threshold_gain); |
32 ~TrendlineEstimator(); | 32 ~TrendlineEstimator(); |
33 | 33 |
34 // Update the estimator with a new sample. The deltas should represent deltas | 34 // Update the estimator with a new sample. The deltas should represent deltas |
35 // between timestamp groups as defined by the InterArrival class. | 35 // between timestamp groups as defined by the InterArrival class. |
36 void Update(double recv_delta_ms, double send_delta_ms, double now_ms); | 36 void Update(double recv_delta_ms, |
37 double send_delta_ms, | |
38 int64_t arrival_time_ms); | |
37 | 39 |
38 // Returns the estimated trend k multiplied by some gain. | 40 // Returns the estimated trend k multiplied by some gain. |
39 // 0 < k < 1 -> the delay increases, queues are filling up | 41 // 0 < k < 1 -> the delay increases, queues are filling up |
40 // k == 0 -> the delay does not change | 42 // k == 0 -> the delay does not change |
41 // k < 0 -> the delay decreases, queues are being emptied | 43 // k < 0 -> the delay decreases, queues are being emptied |
42 double trendline_slope() const { return trendline_ * threshold_gain_; } | 44 double trendline_slope() const { return trendline_ * threshold_gain_; } |
43 | 45 |
44 // Returns the number of deltas which the current estimator state is based on. | 46 // Returns the number of deltas which the current estimator state is based on. |
45 unsigned int num_of_deltas() const { return num_of_deltas_; } | 47 unsigned int num_of_deltas() const { return num_of_deltas_; } |
46 | 48 |
47 private: | 49 private: |
48 // Parameters. | 50 // Parameters. |
49 const size_t window_size_; | 51 const size_t window_size_; |
50 const double smoothing_coef_; | 52 const double smoothing_coef_; |
51 const double threshold_gain_; | 53 const double threshold_gain_; |
52 // Used by the existing threshold. | 54 // Used by the existing threshold. |
53 unsigned int num_of_deltas_; | 55 unsigned int num_of_deltas_; |
56 // Keep the arival times small by using the change from the first packet. | |
brandtr
2016/12/14 09:12:38
"arrival"
terelius
2016/12/14 14:22:32
Done.
| |
57 int64_t first_arrival_time_ms; | |
54 // Exponential backoff filtering. | 58 // Exponential backoff filtering. |
55 double accumulated_delay_; | 59 double accumulated_delay_; |
56 double smoothed_delay_; | 60 double smoothed_delay_; |
57 // Linear least squares regression. | 61 // Linear least squares regression. |
58 std::list<std::pair<double, double>> delay_hist_; | 62 std::list<std::pair<double, double>> delay_hist_; |
brandtr
2016/12/14 09:12:38
Would there be a point in storing the x value as a
| |
59 double trendline_; | 63 double trendline_; |
60 | 64 |
61 RTC_DISALLOW_COPY_AND_ASSIGN(TrendlineEstimator); | 65 RTC_DISALLOW_COPY_AND_ASSIGN(TrendlineEstimator); |
62 }; | 66 }; |
63 } // namespace webrtc | 67 } // namespace webrtc |
64 | 68 |
65 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_TRENDLINE_ESTIMATOR_H_ | 69 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_TRENDLINE_ESTIMATOR_H_ |
OLD | NEW |