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

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

Issue 2637783003: Move congestion controller processing to the pacer thread. (Closed)
Patch Set: Reorder calls in CongestionController::Process. Created 3 years, 11 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/congestion_controller/congestion_controller.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) 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 void UpdateSendHistograms() EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_); 167 void UpdateSendHistograms() EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_);
168 void UpdateReceiveHistograms(); 168 void UpdateReceiveHistograms();
169 void UpdateHistograms(); 169 void UpdateHistograms();
170 void UpdateAggregateNetworkState(); 170 void UpdateAggregateNetworkState();
171 171
172 Clock* const clock_; 172 Clock* const clock_;
173 173
174 const int num_cpu_cores_; 174 const int num_cpu_cores_;
175 const std::unique_ptr<ProcessThread> module_process_thread_; 175 const std::unique_ptr<ProcessThread> module_process_thread_;
176 const std::unique_ptr<ProcessThread> pacer_thread_; 176 const std::unique_ptr<ProcessThread> congestion_controller_thread_;
177 const std::unique_ptr<CallStats> call_stats_; 177 const std::unique_ptr<CallStats> call_stats_;
178 const std::unique_ptr<BitrateAllocator> bitrate_allocator_; 178 const std::unique_ptr<BitrateAllocator> bitrate_allocator_;
179 Call::Config config_; 179 Call::Config config_;
180 rtc::ThreadChecker configuration_thread_checker_; 180 rtc::ThreadChecker configuration_thread_checker_;
181 181
182 NetworkState audio_network_state_; 182 NetworkState audio_network_state_;
183 NetworkState video_network_state_; 183 NetworkState video_network_state_;
184 184
185 std::unique_ptr<RWLockWrapper> receive_crit_; 185 std::unique_ptr<RWLockWrapper> receive_crit_;
186 // Audio, Video, and FlexFEC receive streams are owned by the client that 186 // Audio, Video, and FlexFEC receive streams are owned by the client that
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 Call* Call::Create(const Call::Config& config) { 270 Call* Call::Create(const Call::Config& config) {
271 return new internal::Call(config); 271 return new internal::Call(config);
272 } 272 }
273 273
274 namespace internal { 274 namespace internal {
275 275
276 Call::Call(const Call::Config& config) 276 Call::Call(const Call::Config& config)
277 : clock_(Clock::GetRealTimeClock()), 277 : clock_(Clock::GetRealTimeClock()),
278 num_cpu_cores_(CpuInfo::DetectNumberOfCores()), 278 num_cpu_cores_(CpuInfo::DetectNumberOfCores()),
279 module_process_thread_(ProcessThread::Create("ModuleProcessThread")), 279 module_process_thread_(ProcessThread::Create("ModuleProcessThread")),
280 pacer_thread_(ProcessThread::Create("PacerThread")), 280 congestion_controller_thread_(
281 ProcessThread::Create("CongestionControllerThread")),
281 call_stats_(new CallStats(clock_)), 282 call_stats_(new CallStats(clock_)),
282 bitrate_allocator_(new BitrateAllocator(this)), 283 bitrate_allocator_(new BitrateAllocator(this)),
283 config_(config), 284 config_(config),
284 audio_network_state_(kNetworkDown), 285 audio_network_state_(kNetworkDown),
285 video_network_state_(kNetworkDown), 286 video_network_state_(kNetworkDown),
286 receive_crit_(RWLockWrapper::CreateRWLock()), 287 receive_crit_(RWLockWrapper::CreateRWLock()),
287 send_crit_(RWLockWrapper::CreateRWLock()), 288 send_crit_(RWLockWrapper::CreateRWLock()),
288 event_log_(config.event_log), 289 event_log_(config.event_log),
289 first_packet_sent_ms_(-1), 290 first_packet_sent_ms_(-1),
290 received_bytes_per_second_counter_(clock_, nullptr, true), 291 received_bytes_per_second_counter_(clock_, nullptr, true),
(...skipping 26 matching lines...) Expand all
317 call_stats_->RegisterStatsObserver(congestion_controller_.get()); 318 call_stats_->RegisterStatsObserver(congestion_controller_.get());
318 319
319 congestion_controller_->SignalNetworkState(kNetworkDown); 320 congestion_controller_->SignalNetworkState(kNetworkDown);
320 congestion_controller_->SetBweBitrates( 321 congestion_controller_->SetBweBitrates(
321 config_.bitrate_config.min_bitrate_bps, 322 config_.bitrate_config.min_bitrate_bps,
322 config_.bitrate_config.start_bitrate_bps, 323 config_.bitrate_config.start_bitrate_bps,
323 config_.bitrate_config.max_bitrate_bps); 324 config_.bitrate_config.max_bitrate_bps);
324 325
325 module_process_thread_->Start(); 326 module_process_thread_->Start();
326 module_process_thread_->RegisterModule(call_stats_.get()); 327 module_process_thread_->RegisterModule(call_stats_.get());
327 module_process_thread_->RegisterModule(congestion_controller_.get()); 328 congestion_controller_thread_->RegisterModule(congestion_controller_.get());
328 pacer_thread_->RegisterModule(congestion_controller_->pacer()); 329 congestion_controller_thread_->Start();
329 pacer_thread_->RegisterModule(
330 congestion_controller_->GetRemoteBitrateEstimator(true));
331 pacer_thread_->Start();
332 } 330 }
333 331
334 Call::~Call() { 332 Call::~Call() {
335 RTC_DCHECK(!remb_.InUse()); 333 RTC_DCHECK(!remb_.InUse());
336 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 334 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
337 335
338 RTC_CHECK(audio_send_ssrcs_.empty()); 336 RTC_CHECK(audio_send_ssrcs_.empty());
339 RTC_CHECK(video_send_ssrcs_.empty()); 337 RTC_CHECK(video_send_ssrcs_.empty());
340 RTC_CHECK(video_send_streams_.empty()); 338 RTC_CHECK(video_send_streams_.empty());
341 RTC_CHECK(audio_receive_ssrcs_.empty()); 339 RTC_CHECK(audio_receive_ssrcs_.empty());
342 RTC_CHECK(video_receive_ssrcs_.empty()); 340 RTC_CHECK(video_receive_ssrcs_.empty());
343 RTC_CHECK(video_receive_streams_.empty()); 341 RTC_CHECK(video_receive_streams_.empty());
344 342
345 pacer_thread_->Stop(); 343 congestion_controller_thread_->Stop();
346 pacer_thread_->DeRegisterModule(congestion_controller_->pacer()); 344 congestion_controller_thread_->DeRegisterModule(congestion_controller_.get());
347 pacer_thread_->DeRegisterModule(
348 congestion_controller_->GetRemoteBitrateEstimator(true));
349 module_process_thread_->DeRegisterModule(congestion_controller_.get());
350 module_process_thread_->DeRegisterModule(call_stats_.get()); 345 module_process_thread_->DeRegisterModule(call_stats_.get());
351 module_process_thread_->Stop(); 346 module_process_thread_->Stop();
352 call_stats_->DeregisterStatsObserver(congestion_controller_.get()); 347 call_stats_->DeregisterStatsObserver(congestion_controller_.get());
353 348
354 // Only update histograms after process threads have been shut down, so that 349 // Only update histograms after process threads have been shut down, so that
355 // they won't try to concurrently update stats. 350 // they won't try to concurrently update stats.
356 { 351 {
357 rtc::CritScope lock(&bitrate_crit_); 352 rtc::CritScope lock(&bitrate_crit_);
358 UpdateSendHistograms(); 353 UpdateSendHistograms();
359 } 354 }
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 1201
1207 void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet) { 1202 void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet) {
1208 RTPHeader header; 1203 RTPHeader header;
1209 packet.GetHeader(&header); 1204 packet.GetHeader(&header);
1210 congestion_controller_->OnReceivedPacket(packet.arrival_time_ms(), 1205 congestion_controller_->OnReceivedPacket(packet.arrival_time_ms(),
1211 packet.payload_size(), header); 1206 packet.payload_size(), header);
1212 } 1207 }
1213 1208
1214 } // namespace internal 1209 } // namespace internal
1215 } // namespace webrtc 1210 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/congestion_controller/congestion_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698