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 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 : window_size_(window_size), | 26 : window_size_(window_size), |
27 threshold_gain_(threshold_gain), | 27 threshold_gain_(threshold_gain), |
28 num_of_deltas_(0), | 28 num_of_deltas_(0), |
29 accumulated_delay_(0), | 29 accumulated_delay_(0), |
30 delay_hist_(), | 30 delay_hist_(), |
31 median_filter_(0.5), | 31 median_filter_(0.5), |
32 trendline_(0) {} | 32 trendline_(0) {} |
33 | 33 |
34 MedianSlopeEstimator::~MedianSlopeEstimator() {} | 34 MedianSlopeEstimator::~MedianSlopeEstimator() {} |
35 | 35 |
| 36 MedianSlopeEstimator::DelayInfo::DelayInfo(int64_t time, |
| 37 double delay, |
| 38 size_t slope_count) |
| 39 : time(time), delay(delay) { |
| 40 slopes.reserve(slope_count); |
| 41 } |
| 42 |
| 43 MedianSlopeEstimator::DelayInfo::~DelayInfo() = default; |
| 44 |
36 void MedianSlopeEstimator::Update(double recv_delta_ms, | 45 void MedianSlopeEstimator::Update(double recv_delta_ms, |
37 double send_delta_ms, | 46 double send_delta_ms, |
38 int64_t arrival_time_ms) { | 47 int64_t arrival_time_ms) { |
39 const double delta_ms = recv_delta_ms - send_delta_ms; | 48 const double delta_ms = recv_delta_ms - send_delta_ms; |
40 ++num_of_deltas_; | 49 ++num_of_deltas_; |
41 if (num_of_deltas_ > kDeltaCounterMax) | 50 if (num_of_deltas_ > kDeltaCounterMax) |
42 num_of_deltas_ = kDeltaCounterMax; | 51 num_of_deltas_ = kDeltaCounterMax; |
43 | 52 |
44 accumulated_delay_ += delta_ms; | 53 accumulated_delay_ += delta_ms; |
45 BWE_TEST_LOGGING_PLOT(1, "accumulated_delay_ms", arrival_time_ms, | 54 BWE_TEST_LOGGING_PLOT(1, "accumulated_delay_ms", arrival_time_ms, |
(...skipping 29 matching lines...) Expand all Loading... |
75 delay_hist_.emplace_back(arrival_time_ms, accumulated_delay_, | 84 delay_hist_.emplace_back(arrival_time_ms, accumulated_delay_, |
76 window_size_ - 1); | 85 window_size_ - 1); |
77 // Recompute the median slope. | 86 // Recompute the median slope. |
78 if (delay_hist_.size() == window_size_) | 87 if (delay_hist_.size() == window_size_) |
79 trendline_ = median_filter_.GetPercentileValue(); | 88 trendline_ = median_filter_.GetPercentileValue(); |
80 | 89 |
81 BWE_TEST_LOGGING_PLOT(1, "trendline_slope", arrival_time_ms, trendline_); | 90 BWE_TEST_LOGGING_PLOT(1, "trendline_slope", arrival_time_ms, trendline_); |
82 } | 91 } |
83 | 92 |
84 } // namespace webrtc | 93 } // namespace webrtc |
OLD | NEW |