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_MEDIAN_SLOPE_ESTIMATOR_H_ | 10 #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_MEDIAN_SLOPE_ESTIMATOR_H_ |
(...skipping 30 matching lines...) Expand all Loading... |
41 // 0 < k < 1 -> the delay increases, queues are filling up | 41 // 0 < k < 1 -> the delay increases, queues are filling up |
42 // k == 0 -> the delay does not change | 42 // k == 0 -> the delay does not change |
43 // k < 0 -> the delay decreases, queues are being emptied | 43 // k < 0 -> the delay decreases, queues are being emptied |
44 double trendline_slope() const { return trendline_ * threshold_gain_; } | 44 double trendline_slope() const { return trendline_ * threshold_gain_; } |
45 | 45 |
46 // 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. |
47 unsigned int num_of_deltas() const { return num_of_deltas_; } | 47 unsigned int num_of_deltas() const { return num_of_deltas_; } |
48 | 48 |
49 private: | 49 private: |
50 struct DelayInfo { | 50 struct DelayInfo { |
51 DelayInfo(int64_t time, double delay, size_t slope_count) | 51 DelayInfo(int64_t time, double delay, size_t slope_count); |
52 : time(time), delay(delay) { | 52 ~DelayInfo(); |
53 slopes.reserve(slope_count); | |
54 } | |
55 int64_t time; | 53 int64_t time; |
56 double delay; | 54 double delay; |
57 std::vector<double> slopes; | 55 std::vector<double> slopes; |
58 }; | 56 }; |
59 // Parameters. | 57 // Parameters. |
60 const size_t window_size_; | 58 const size_t window_size_; |
61 const double threshold_gain_; | 59 const double threshold_gain_; |
62 // Used by the existing threshold. | 60 // Used by the existing threshold. |
63 unsigned int num_of_deltas_; | 61 unsigned int num_of_deltas_; |
64 // Theil-Sen robust line fitting | 62 // Theil-Sen robust line fitting |
65 double accumulated_delay_; | 63 double accumulated_delay_; |
66 std::deque<DelayInfo> delay_hist_; | 64 std::deque<DelayInfo> delay_hist_; |
67 PercentileFilter<double> median_filter_; | 65 PercentileFilter<double> median_filter_; |
68 double trendline_; | 66 double trendline_; |
69 | 67 |
70 RTC_DISALLOW_COPY_AND_ASSIGN(MedianSlopeEstimator); | 68 RTC_DISALLOW_COPY_AND_ASSIGN(MedianSlopeEstimator); |
71 }; | 69 }; |
72 } // namespace webrtc | 70 } // namespace webrtc |
73 | 71 |
74 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_MEDIAN_SLOPE_ESTIMATOR_H_ | 72 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_MEDIAN_SLOPE_ESTIMATOR_H_ |
OLD | NEW |