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

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

Issue 2111813002: Revert of Move RtcEventLog object from inside VoiceEngine to Call. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 5 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 */
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 total_number_of_packets, now_ms); 72 total_number_of_packets, now_ms);
73 } 73 }
74 74
75 private: 75 private:
76 std::map<uint32_t, uint32_t> ssrc_to_last_received_extended_high_seq_num_; 76 std::map<uint32_t, uint32_t> ssrc_to_last_received_extended_high_seq_num_;
77 BitrateControllerImpl* owner_; 77 BitrateControllerImpl* owner_;
78 }; 78 };
79 79
80 BitrateController* BitrateController::CreateBitrateController( 80 BitrateController* BitrateController::CreateBitrateController(
81 Clock* clock, 81 Clock* clock,
82 BitrateObserver* observer, 82 BitrateObserver* observer) {
83 RtcEventLog* event_log) { 83 return new BitrateControllerImpl(clock, observer);
84 return new BitrateControllerImpl(clock, observer, event_log);
85 } 84 }
86 85
87 BitrateController* BitrateController::CreateBitrateController( 86 BitrateController* BitrateController::CreateBitrateController(Clock* clock) {
88 Clock* clock, 87 return new BitrateControllerImpl(clock, nullptr);
89 RtcEventLog* event_log) {
90 return CreateBitrateController(clock, nullptr, event_log);
91 } 88 }
92 89
93 BitrateControllerImpl::BitrateControllerImpl(Clock* clock, 90 BitrateControllerImpl::BitrateControllerImpl(Clock* clock,
94 BitrateObserver* observer, 91 BitrateObserver* observer)
95 RtcEventLog* event_log)
96 : clock_(clock), 92 : clock_(clock),
97 observer_(observer), 93 observer_(observer),
98 last_bitrate_update_ms_(clock_->TimeInMilliseconds()), 94 last_bitrate_update_ms_(clock_->TimeInMilliseconds()),
99 event_log_(event_log), 95 bandwidth_estimation_(),
100 bandwidth_estimation_(event_log),
101 reserved_bitrate_bps_(0), 96 reserved_bitrate_bps_(0),
102 last_bitrate_bps_(0), 97 last_bitrate_bps_(0),
103 last_fraction_loss_(0), 98 last_fraction_loss_(0),
104 last_rtt_ms_(0), 99 last_rtt_ms_(0),
105 last_reserved_bitrate_bps_(0) { 100 last_reserved_bitrate_bps_(0) {
106 // This calls the observer_ if set, which means that the observer provided by 101 // This calls the observer_ if set, which means that the observer provided by
107 // the user must be ready to accept a bitrate update when it constructs the 102 // the user must be ready to accept a bitrate update when it constructs the
108 // controller. We do this to avoid having to keep synchronized initial values 103 // controller. We do this to avoid having to keep synchronized initial values
109 // in both the controller and the allocator. 104 // in both the controller and the allocator.
110 MaybeTriggerOnNetworkChanged(); 105 MaybeTriggerOnNetworkChanged();
(...skipping 30 matching lines...) Expand all
141 max_bitrate_bps); 136 max_bitrate_bps);
142 } 137 }
143 MaybeTriggerOnNetworkChanged(); 138 MaybeTriggerOnNetworkChanged();
144 } 139 }
145 140
146 void BitrateControllerImpl::ResetBitrates(int bitrate_bps, 141 void BitrateControllerImpl::ResetBitrates(int bitrate_bps,
147 int min_bitrate_bps, 142 int min_bitrate_bps,
148 int max_bitrate_bps) { 143 int max_bitrate_bps) {
149 { 144 {
150 rtc::CritScope cs(&critsect_); 145 rtc::CritScope cs(&critsect_);
151 bandwidth_estimation_ = SendSideBandwidthEstimation(event_log_); 146 bandwidth_estimation_ = SendSideBandwidthEstimation();
152 bandwidth_estimation_.SetBitrates(bitrate_bps, min_bitrate_bps, 147 bandwidth_estimation_.SetBitrates(bitrate_bps, min_bitrate_bps,
153 max_bitrate_bps); 148 max_bitrate_bps);
154 } 149 }
155 MaybeTriggerOnNetworkChanged(); 150 MaybeTriggerOnNetworkChanged();
156 } 151 }
157 152
158 void BitrateControllerImpl::SetReservedBitrate(uint32_t reserved_bitrate_bps) { 153 void BitrateControllerImpl::SetReservedBitrate(uint32_t reserved_bitrate_bps) {
159 { 154 {
160 rtc::CritScope cs(&critsect_); 155 rtc::CritScope cs(&critsect_);
161 reserved_bitrate_bps_ = reserved_bitrate_bps; 156 reserved_bitrate_bps_ = reserved_bitrate_bps;
162 } 157 }
163 MaybeTriggerOnNetworkChanged(); 158 MaybeTriggerOnNetworkChanged();
164 } 159 }
165 160
161 void BitrateControllerImpl::SetEventLog(RtcEventLog* event_log) {
162 rtc::CritScope cs(&critsect_);
163 bandwidth_estimation_.SetEventLog(event_log);
164 }
165
166 void BitrateControllerImpl::OnReceivedEstimatedBitrate(uint32_t bitrate) { 166 void BitrateControllerImpl::OnReceivedEstimatedBitrate(uint32_t bitrate) {
167 { 167 {
168 rtc::CritScope cs(&critsect_); 168 rtc::CritScope cs(&critsect_);
169 bandwidth_estimation_.UpdateReceiverEstimate(clock_->TimeInMilliseconds(), 169 bandwidth_estimation_.UpdateReceiverEstimate(clock_->TimeInMilliseconds(),
170 bitrate); 170 bitrate);
171 } 171 }
172 MaybeTriggerOnNetworkChanged(); 172 MaybeTriggerOnNetworkChanged();
173 } 173 }
174 174
175 void BitrateControllerImpl::UpdateDelayBasedEstimate(uint32_t bitrate_bps) { 175 void BitrateControllerImpl::UpdateDelayBasedEstimate(uint32_t bitrate_bps) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); 258 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt);
259 if (bitrate > 0) { 259 if (bitrate > 0) {
260 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); 260 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_);
261 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); 261 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate());
262 *bandwidth = bitrate; 262 *bandwidth = bitrate;
263 return true; 263 return true;
264 } 264 }
265 return false; 265 return false;
266 } 266 }
267 } // namespace webrtc 267 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698