Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(547)

Side by Side Diff: webrtc/modules/congestion_controller/trendline_estimator.cc

Issue 3011943002: Move optional.h to webrtc/api/ (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW
« no previous file with comments | « webrtc/modules/congestion_controller/bitrate_estimator.h ('k') | webrtc/modules/include/module_common_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698