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

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

Issue 2695923004: Add logging of delay-based bandwidth estimate. (Closed)
Patch Set: Created 3 years, 10 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/delay_based_bwe.h" 11 #include "webrtc/modules/congestion_controller/delay_based_bwe.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <cmath> 14 #include <cmath>
15 #include <string> 15 #include <string>
16 16
17 #include "webrtc/base/checks.h" 17 #include "webrtc/base/checks.h"
18 #include "webrtc/base/constructormagic.h" 18 #include "webrtc/base/constructormagic.h"
19 #include "webrtc/base/logging.h" 19 #include "webrtc/base/logging.h"
20 #include "webrtc/base/thread_annotations.h" 20 #include "webrtc/base/thread_annotations.h"
21 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
21 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" 22 #include "webrtc/modules/congestion_controller/include/congestion_controller.h"
22 #include "webrtc/modules/pacing/paced_sender.h" 23 #include "webrtc/modules/pacing/paced_sender.h"
23 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h" 24 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h"
24 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" 25 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
25 #include "webrtc/system_wrappers/include/field_trial.h" 26 #include "webrtc/system_wrappers/include/field_trial.h"
26 #include "webrtc/system_wrappers/include/metrics.h" 27 #include "webrtc/system_wrappers/include/metrics.h"
27 #include "webrtc/typedefs.h" 28 #include "webrtc/typedefs.h"
28 29
29 namespace { 30 namespace {
30 constexpr int kTimestampGroupLengthMs = 5; 31 constexpr int kTimestampGroupLengthMs = 5;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 sum_ += bytes; 202 sum_ += bytes;
202 return bitrate_sample; 203 return bitrate_sample;
203 } 204 }
204 205
205 rtc::Optional<uint32_t> DelayBasedBwe::BitrateEstimator::bitrate_bps() const { 206 rtc::Optional<uint32_t> DelayBasedBwe::BitrateEstimator::bitrate_bps() const {
206 if (bitrate_estimate_ < 0.f) 207 if (bitrate_estimate_ < 0.f)
207 return rtc::Optional<uint32_t>(); 208 return rtc::Optional<uint32_t>();
208 return rtc::Optional<uint32_t>(bitrate_estimate_ * 1000); 209 return rtc::Optional<uint32_t>(bitrate_estimate_ * 1000);
209 } 210 }
210 211
211 DelayBasedBwe::DelayBasedBwe(Clock* clock) 212 DelayBasedBwe::DelayBasedBwe(RtcEventLog* event_log, Clock* clock)
212 : in_trendline_experiment_(TrendlineFilterExperimentIsEnabled()), 213 : in_trendline_experiment_(TrendlineFilterExperimentIsEnabled()),
213 in_median_slope_experiment_(MedianSlopeFilterExperimentIsEnabled()), 214 in_median_slope_experiment_(MedianSlopeFilterExperimentIsEnabled()),
215 event_log_(event_log),
214 clock_(clock), 216 clock_(clock),
215 inter_arrival_(), 217 inter_arrival_(),
216 kalman_estimator_(), 218 kalman_estimator_(),
217 trendline_estimator_(), 219 trendline_estimator_(),
218 detector_(), 220 detector_(),
219 receiver_incoming_bitrate_(), 221 receiver_incoming_bitrate_(),
220 last_update_ms_(-1), 222 last_update_ms_(-1),
221 last_seen_packet_ms_(-1), 223 last_seen_packet_ms_(-1),
222 uma_recorded_(false), 224 uma_recorded_(false),
223 trendline_window_size_(kDefaultTrendlineWindowSize), 225 trendline_window_size_(kDefaultTrendlineWindowSize),
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 (last_update_ms_ == -1 || 384 (last_update_ms_ == -1 ||
383 now_ms - last_update_ms_ > rate_control_.GetFeedbackInterval())) { 385 now_ms - last_update_ms_ > rate_control_.GetFeedbackInterval())) {
384 result.updated = 386 result.updated =
385 UpdateEstimate(info.arrival_time_ms, now_ms, acked_bitrate_bps, 387 UpdateEstimate(info.arrival_time_ms, now_ms, acked_bitrate_bps,
386 &result.target_bitrate_bps); 388 &result.target_bitrate_bps);
387 } 389 }
388 if (result.updated) { 390 if (result.updated) {
389 last_update_ms_ = now_ms; 391 last_update_ms_ = now_ms;
390 BWE_TEST_LOGGING_PLOT(1, "target_bitrate_bps", now_ms, 392 BWE_TEST_LOGGING_PLOT(1, "target_bitrate_bps", now_ms,
391 result.target_bitrate_bps); 393 result.target_bitrate_bps);
394 if (event_log_) {
stefan-webrtc 2017/02/14 18:13:20 Should we pass a null object instead?
terelius 2017/02/15 12:49:24 I don't know. We use a null implementation in some
stefan-webrtc 2017/02/16 10:22:28 I tend to prefer null objects, but I don't feel th
395 event_log_->LogBwePacketDelayEvent(result.target_bitrate_bps,
396 detector_.State());
397 }
392 } 398 }
393 399
394 return result; 400 return result;
395 } 401 }
396 402
397 bool DelayBasedBwe::UpdateEstimate(int64_t arrival_time_ms, 403 bool DelayBasedBwe::UpdateEstimate(int64_t arrival_time_ms,
398 int64_t now_ms, 404 int64_t now_ms,
399 rtc::Optional<uint32_t> acked_bitrate_bps, 405 rtc::Optional<uint32_t> acked_bitrate_bps,
400 uint32_t* target_bitrate_bps) { 406 uint32_t* target_bitrate_bps) {
401 // TODO(terelius): RateControlInput::noise_var is deprecated and will be 407 // TODO(terelius): RateControlInput::noise_var is deprecated and will be
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 void DelayBasedBwe::SetMinBitrate(int min_bitrate_bps) { 440 void DelayBasedBwe::SetMinBitrate(int min_bitrate_bps) {
435 // Called from both the configuration thread and the network thread. Shouldn't 441 // Called from both the configuration thread and the network thread. Shouldn't
436 // be called from the network thread in the future. 442 // be called from the network thread in the future.
437 rate_control_.SetMinBitrate(min_bitrate_bps); 443 rate_control_.SetMinBitrate(min_bitrate_bps);
438 } 444 }
439 445
440 int64_t DelayBasedBwe::GetProbingIntervalMs() const { 446 int64_t DelayBasedBwe::GetProbingIntervalMs() const {
441 return probing_interval_estimator_.GetIntervalMs(); 447 return probing_interval_estimator_.GetIntervalMs();
442 } 448 }
443 } // namespace webrtc 449 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698