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

Side by Side Diff: webrtc/call/call.cc

Issue 1704983002: Simplify CongestionController. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comments addressed. Created 4 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
« no previous file with comments | « webrtc/call/bitrate_estimator_tests.cc ('k') | webrtc/call/congestion_controller.h » ('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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 received_video_bytes_(0), 192 received_video_bytes_(0),
193 received_audio_bytes_(0), 193 received_audio_bytes_(0),
194 received_rtcp_bytes_(0), 194 received_rtcp_bytes_(0),
195 first_rtp_packet_received_ms_(-1), 195 first_rtp_packet_received_ms_(-1),
196 last_rtp_packet_received_ms_(-1), 196 last_rtp_packet_received_ms_(-1),
197 first_packet_sent_ms_(-1), 197 first_packet_sent_ms_(-1),
198 estimated_send_bitrate_sum_kbits_(0), 198 estimated_send_bitrate_sum_kbits_(0),
199 pacer_bitrate_sum_kbits_(0), 199 pacer_bitrate_sum_kbits_(0),
200 num_bitrate_updates_(0), 200 num_bitrate_updates_(0),
201 remb_(clock_), 201 remb_(clock_),
202 congestion_controller_( 202 congestion_controller_(new CongestionController(clock_, this, &remb_)) {
203 new CongestionController(clock_,
204 module_process_thread_.get(),
205 call_stats_.get(),
206 this,
207 &remb_)) {
208 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 203 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
209 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); 204 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0);
210 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, 205 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps,
211 config.bitrate_config.min_bitrate_bps); 206 config.bitrate_config.min_bitrate_bps);
212 if (config.bitrate_config.max_bitrate_bps != -1) { 207 if (config.bitrate_config.max_bitrate_bps != -1) {
213 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, 208 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps,
214 config.bitrate_config.start_bitrate_bps); 209 config.bitrate_config.start_bitrate_bps);
215 } 210 }
216 if (config.audio_state.get()) { 211 if (config.audio_state.get()) {
217 ScopedVoEInterface<VoECodec> voe_codec(voice_engine()); 212 ScopedVoEInterface<VoECodec> voe_codec(voice_engine());
218 event_log_ = voe_codec->GetEventLog(); 213 event_log_ = voe_codec->GetEventLog();
219 } 214 }
220 215
221 Trace::CreateTrace(); 216 Trace::CreateTrace();
222 module_process_thread_->Start(); 217 module_process_thread_->Start();
223 module_process_thread_->RegisterModule(call_stats_.get()); 218 module_process_thread_->RegisterModule(call_stats_.get());
219 module_process_thread_->RegisterModule(congestion_controller_.get());
220 call_stats_->RegisterStatsObserver(congestion_controller_.get());
224 221
225 congestion_controller_->SetBweBitrates( 222 congestion_controller_->SetBweBitrates(
226 config_.bitrate_config.min_bitrate_bps, 223 config_.bitrate_config.min_bitrate_bps,
227 config_.bitrate_config.start_bitrate_bps, 224 config_.bitrate_config.start_bitrate_bps,
228 config_.bitrate_config.max_bitrate_bps); 225 config_.bitrate_config.max_bitrate_bps);
229 226
230 congestion_controller_->GetBitrateController()->SetEventLog(event_log_); 227 congestion_controller_->GetBitrateController()->SetEventLog(event_log_);
231 } 228 }
232 229
233 Call::~Call() { 230 Call::~Call() {
234 RTC_DCHECK(!remb_.InUse()); 231 RTC_DCHECK(!remb_.InUse());
235 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 232 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
236 UpdateSendHistograms(); 233 UpdateSendHistograms();
237 UpdateReceiveHistograms(); 234 UpdateReceiveHistograms();
238 RTC_CHECK(audio_send_ssrcs_.empty()); 235 RTC_CHECK(audio_send_ssrcs_.empty());
239 RTC_CHECK(video_send_ssrcs_.empty()); 236 RTC_CHECK(video_send_ssrcs_.empty());
240 RTC_CHECK(video_send_streams_.empty()); 237 RTC_CHECK(video_send_streams_.empty());
241 RTC_CHECK(audio_receive_ssrcs_.empty()); 238 RTC_CHECK(audio_receive_ssrcs_.empty());
242 RTC_CHECK(video_receive_ssrcs_.empty()); 239 RTC_CHECK(video_receive_ssrcs_.empty());
243 RTC_CHECK(video_receive_streams_.empty()); 240 RTC_CHECK(video_receive_streams_.empty());
244 241
242 call_stats_->DeregisterStatsObserver(congestion_controller_.get());
243 module_process_thread_->DeRegisterModule(congestion_controller_.get());
245 module_process_thread_->DeRegisterModule(call_stats_.get()); 244 module_process_thread_->DeRegisterModule(call_stats_.get());
246 module_process_thread_->Stop(); 245 module_process_thread_->Stop();
247 Trace::ReturnTrace(); 246 Trace::ReturnTrace();
248 } 247 }
249 248
250 void Call::UpdateSendHistograms() { 249 void Call::UpdateSendHistograms() {
251 if (num_bitrate_updates_ == 0 || first_packet_sent_ms_ == -1) 250 if (num_bitrate_updates_ == 0 || first_packet_sent_ms_ == -1)
252 return; 251 return;
253 int64_t elapsed_sec = 252 int64_t elapsed_sec =
254 (clock_->TimeInMilliseconds() - first_packet_sent_ms_) / 1000; 253 (clock_->TimeInMilliseconds() - first_packet_sent_ms_) / 1000;
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 // thread. Then this check can be enabled. 742 // thread. Then this check can be enabled.
744 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); 743 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread());
745 if (RtpHeaderParser::IsRtcp(packet, length)) 744 if (RtpHeaderParser::IsRtcp(packet, length))
746 return DeliverRtcp(media_type, packet, length); 745 return DeliverRtcp(media_type, packet, length);
747 746
748 return DeliverRtp(media_type, packet, length, packet_time); 747 return DeliverRtp(media_type, packet, length, packet_time);
749 } 748 }
750 749
751 } // namespace internal 750 } // namespace internal
752 } // namespace webrtc 751 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call/bitrate_estimator_tests.cc ('k') | webrtc/call/congestion_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698