| 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 |
| 11 #include "webrtc/modules/congestion_controller/trendline_estimator.h" | 11 #include "webrtc/modules/congestion_controller/trendline_estimator.h" |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 | 14 |
| 15 #include "webrtc/api/optional.h" |
| 15 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" | 16 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" |
| 16 #include "webrtc/rtc_base/checks.h" | 17 #include "webrtc/rtc_base/checks.h" |
| 17 #include "webrtc/rtc_base/optional.h" | |
| 18 | 18 |
| 19 namespace webrtc { | 19 namespace webrtc { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 rtc::Optional<double> LinearFitSlope( | 22 rtc::Optional<double> LinearFitSlope( |
| 23 const std::deque<std::pair<double, double>>& points) { | 23 const std::deque<std::pair<double, double>>& points) { |
| 24 RTC_DCHECK(points.size() >= 2); | 24 RTC_DCHECK(points.size() >= 2); |
| 25 // Compute the "center of mass". | 25 // Compute the "center of mass". |
| 26 double sum_x = 0; | 26 double sum_x = 0; |
| 27 double sum_y = 0; | 27 double sum_y = 0; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 delay_hist_.pop_front(); | 88 delay_hist_.pop_front(); |
| 89 if (delay_hist_.size() == window_size_) { | 89 if (delay_hist_.size() == window_size_) { |
| 90 // Only update trendline_ if it is possible to fit a line to the data. | 90 // Only update trendline_ if it is possible to fit a line to the data. |
| 91 trendline_ = LinearFitSlope(delay_hist_).value_or(trendline_); | 91 trendline_ = LinearFitSlope(delay_hist_).value_or(trendline_); |
| 92 } | 92 } |
| 93 | 93 |
| 94 BWE_TEST_LOGGING_PLOT(1, "trendline_slope", arrival_time_ms, trendline_); | 94 BWE_TEST_LOGGING_PLOT(1, "trendline_slope", arrival_time_ms, trendline_); |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace webrtc | 97 } // namespace webrtc |
| OLD | NEW |