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

Side by Side Diff: webrtc/modules/bitrate_controller/bitrate_controller_impl.cc

Issue 2296253002: Enable BWE logging to command line when rtc_enable_bwe_test_logging is set to true (Closed)
Patch Set: adding macro declaration Created 4 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 11
12 #include "webrtc/modules/bitrate_controller/bitrate_controller_impl.h" 12 #include "webrtc/modules/bitrate_controller/bitrate_controller_impl.h"
13 13
14 #include <algorithm> 14 #include <algorithm>
15 #include <map> 15 #include <map>
16 #include <utility> 16 #include <utility>
17 17
18 #include "webrtc/base/checks.h" 18 #include "webrtc/base/checks.h"
19 #include "webrtc/base/logging.h" 19 #include "webrtc/base/logging.h"
20 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 21 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 24
24 class BitrateControllerImpl::RtcpBandwidthObserverImpl 25 class BitrateControllerImpl::RtcpBandwidthObserverImpl
25 : public RtcpBandwidthObserver { 26 : public RtcpBandwidthObserver {
26 public: 27 public:
27 explicit RtcpBandwidthObserverImpl(BitrateControllerImpl* owner) 28 explicit RtcpBandwidthObserverImpl(BitrateControllerImpl* owner)
28 : owner_(owner) { 29 : owner_(owner) {
29 } 30 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 173 }
173 MaybeTriggerOnNetworkChanged(); 174 MaybeTriggerOnNetworkChanged();
174 } 175 }
175 176
176 // This is called upon reception of REMB or TMMBR. 177 // This is called upon reception of REMB or TMMBR.
177 void BitrateControllerImpl::OnReceiverEstimatedBitrate(uint32_t bitrate) { 178 void BitrateControllerImpl::OnReceiverEstimatedBitrate(uint32_t bitrate) {
178 { 179 {
179 rtc::CritScope cs(&critsect_); 180 rtc::CritScope cs(&critsect_);
180 bandwidth_estimation_.UpdateReceiverEstimate(clock_->TimeInMilliseconds(), 181 bandwidth_estimation_.UpdateReceiverEstimate(clock_->TimeInMilliseconds(),
181 bitrate); 182 bitrate);
183 BWE_TEST_LOGGING_PLOT(1, "REMB[kbps]", clock_->TimeInMilliseconds(),
184 bitrate / 1000);
182 } 185 }
183 MaybeTriggerOnNetworkChanged(); 186 MaybeTriggerOnNetworkChanged();
184 } 187 }
185 188
186 void BitrateControllerImpl::OnProbeBitrate(uint32_t bitrate_bps) { 189 void BitrateControllerImpl::OnProbeBitrate(uint32_t bitrate_bps) {
187 { 190 {
188 rtc::CritScope cs(&critsect_); 191 rtc::CritScope cs(&critsect_);
189 bandwidth_estimation_.SetSendBitrate(bitrate_bps); 192 bandwidth_estimation_.SetSendBitrate(bitrate_bps);
190 } 193 }
191 MaybeTriggerOnNetworkChanged(); 194 MaybeTriggerOnNetworkChanged();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 bool new_bitrate = false; 265 bool new_bitrate = false;
263 if (*bitrate != last_bitrate_bps_ || *fraction_loss != last_fraction_loss_ || 266 if (*bitrate != last_bitrate_bps_ || *fraction_loss != last_fraction_loss_ ||
264 *rtt != last_rtt_ms_ || 267 *rtt != last_rtt_ms_ ||
265 last_reserved_bitrate_bps_ != reserved_bitrate_bps_) { 268 last_reserved_bitrate_bps_ != reserved_bitrate_bps_) {
266 last_bitrate_bps_ = *bitrate; 269 last_bitrate_bps_ = *bitrate;
267 last_fraction_loss_ = *fraction_loss; 270 last_fraction_loss_ = *fraction_loss;
268 last_rtt_ms_ = *rtt; 271 last_rtt_ms_ = *rtt;
269 last_reserved_bitrate_bps_ = reserved_bitrate_bps_; 272 last_reserved_bitrate_bps_ = reserved_bitrate_bps_;
270 new_bitrate = true; 273 new_bitrate = true;
271 } 274 }
275
276 BWE_TEST_LOGGING_PLOT(1, "fraction_loss_[%%]", clock_->TimeInMilliseconds(),
277 (last_fraction_loss_ * 100) / 256);
278 BWE_TEST_LOGGING_PLOT(1, "rtt[ms]", clock_->TimeInMilliseconds(),
279 last_rtt_ms_);
280 BWE_TEST_LOGGING_PLOT(1, "Target_bitrate[kbps]", clock_->TimeInMilliseconds(),
281 last_bitrate_bps_ / 1000);
282
272 return new_bitrate; 283 return new_bitrate;
273 } 284 }
274 285
275 bool BitrateControllerImpl::AvailableBandwidth(uint32_t* bandwidth) const { 286 bool BitrateControllerImpl::AvailableBandwidth(uint32_t* bandwidth) const {
276 rtc::CritScope cs(&critsect_); 287 rtc::CritScope cs(&critsect_);
277 int bitrate; 288 int bitrate;
278 uint8_t fraction_loss; 289 uint8_t fraction_loss;
279 int64_t rtt; 290 int64_t rtt;
280 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); 291 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt);
281 if (bitrate > 0) { 292 if (bitrate > 0) {
282 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); 293 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_);
283 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); 294 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate());
284 *bandwidth = bitrate; 295 *bandwidth = bitrate;
285 return true; 296 return true;
286 } 297 }
287 return false; 298 return false;
288 } 299 }
289 } // namespace webrtc 300 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/bitrate_controller/bitrate_controller.gypi ('k') | webrtc/modules/congestion_controller/delay_based_bwe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698