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

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

Issue 2933243003: Plot acknowledged bitrate when compiled with rtc_enable_bwe_test_logging. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | webrtc/modules/remote_bitrate_estimator/overuse_detector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 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/acknowledge_bitrate_estimator.h" 11 #include "webrtc/modules/congestion_controller/acknowledge_bitrate_estimator.h"
12 12
13 #include <cmath> 13 #include <cmath>
14 14
15 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
15 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 16 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
16 17
17 namespace webrtc { 18 namespace webrtc {
18 19
19 namespace { 20 namespace {
20 constexpr int kInitialRateWindowMs = 500; 21 constexpr int kInitialRateWindowMs = 500;
21 constexpr int kRateWindowMs = 150; 22 constexpr int kRateWindowMs = 150;
22 23
23 bool IsInSendTimeHistory(const PacketFeedback& packet) { 24 bool IsInSendTimeHistory(const PacketFeedback& packet) {
24 return packet.send_time_ms >= 0; 25 return packet.send_time_ms >= 0;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // Update a bayesian estimate of the rate, weighting it lower if the sample 67 // Update a bayesian estimate of the rate, weighting it lower if the sample
67 // uncertainty is large. 68 // uncertainty is large.
68 // The bitrate estimate uncertainty is increased with each update to model 69 // The bitrate estimate uncertainty is increased with each update to model
69 // that the bitrate changes over time. 70 // that the bitrate changes over time.
70 float pred_bitrate_estimate_var = bitrate_estimate_var_ + 5.f; 71 float pred_bitrate_estimate_var = bitrate_estimate_var_ + 5.f;
71 bitrate_estimate_ = (sample_var * bitrate_estimate_ + 72 bitrate_estimate_ = (sample_var * bitrate_estimate_ +
72 pred_bitrate_estimate_var * bitrate_sample) / 73 pred_bitrate_estimate_var * bitrate_sample) /
73 (sample_var + pred_bitrate_estimate_var); 74 (sample_var + pred_bitrate_estimate_var);
74 bitrate_estimate_var_ = sample_var * pred_bitrate_estimate_var / 75 bitrate_estimate_var_ = sample_var * pred_bitrate_estimate_var /
75 (sample_var + pred_bitrate_estimate_var); 76 (sample_var + pred_bitrate_estimate_var);
77 BWE_TEST_LOGGING_PLOT(1, "acknowledged_bitrate", now_ms,
78 bitrate_estimate_ * 1000);
76 } 79 }
77 80
78 float AcknowledgedBitrateEstimator::UpdateWindow(int64_t now_ms, 81 float AcknowledgedBitrateEstimator::UpdateWindow(int64_t now_ms,
79 int bytes, 82 int bytes,
80 int rate_window_ms) { 83 int rate_window_ms) {
81 // Reset if time moves backwards. 84 // Reset if time moves backwards.
82 if (now_ms < prev_time_ms_) { 85 if (now_ms < prev_time_ms_) {
83 prev_time_ms_ = -1; 86 prev_time_ms_ = -1;
84 sum_ = 0; 87 sum_ = 0;
85 current_win_ms_ = 0; 88 current_win_ms_ = 0;
(...skipping 17 matching lines...) Expand all
103 return bitrate_sample; 106 return bitrate_sample;
104 } 107 }
105 108
106 rtc::Optional<uint32_t> AcknowledgedBitrateEstimator::bitrate_bps() const { 109 rtc::Optional<uint32_t> AcknowledgedBitrateEstimator::bitrate_bps() const {
107 if (bitrate_estimate_ < 0.f) 110 if (bitrate_estimate_ < 0.f)
108 return rtc::Optional<uint32_t>(); 111 return rtc::Optional<uint32_t>();
109 return rtc::Optional<uint32_t>(bitrate_estimate_ * 1000); 112 return rtc::Optional<uint32_t>(bitrate_estimate_ * 1000);
110 } 113 }
111 114
112 } // namespace webrtc 115 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/remote_bitrate_estimator/overuse_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698