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

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

Issue 2644603003: Revert of Move congestion controller processing to the pacer thread. (Closed)
Patch Set: 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> congestion_controller_thread_; 176 const std::unique_ptr<ProcessThread> pacer_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 congestion_controller_thread_( 280 pacer_thread_(ProcessThread::Create("PacerThread")),
281 ProcessThread::Create("CongestionControllerThread")),
282 call_stats_(new CallStats(clock_)), 281 call_stats_(new CallStats(clock_)),
283 bitrate_allocator_(new BitrateAllocator(this)), 282 bitrate_allocator_(new BitrateAllocator(this)),
284 config_(config), 283 config_(config),
285 audio_network_state_(kNetworkDown), 284 audio_network_state_(kNetworkDown),
286 video_network_state_(kNetworkDown), 285 video_network_state_(kNetworkDown),
287 receive_crit_(RWLockWrapper::CreateRWLock()), 286 receive_crit_(RWLockWrapper::CreateRWLock()),
288 send_crit_(RWLockWrapper::CreateRWLock()), 287 send_crit_(RWLockWrapper::CreateRWLock()),
289 event_log_(config.event_log), 288 event_log_(config.event_log),
290 first_packet_sent_ms_(-1), 289 first_packet_sent_ms_(-1),
291 received_bytes_per_second_counter_(clock_, nullptr, true), 290 received_bytes_per_second_counter_(clock_, nullptr, true),
(...skipping 26 matching lines...) Expand all
318 call_stats_->RegisterStatsObserver(congestion_controller_.get()); 317 call_stats_->RegisterStatsObserver(congestion_controller_.get());
319 318
320 congestion_controller_->SignalNetworkState(kNetworkDown); 319 congestion_controller_->SignalNetworkState(kNetworkDown);
321 congestion_controller_->SetBweBitrates( 320 congestion_controller_->SetBweBitrates(
322 config_.bitrate_config.min_bitrate_bps, 321 config_.bitrate_config.min_bitrate_bps,
323 config_.bitrate_config.start_bitrate_bps, 322 config_.bitrate_config.start_bitrate_bps,
324 config_.bitrate_config.max_bitrate_bps); 323 config_.bitrate_config.max_bitrate_bps);
325 324
326 module_process_thread_->Start(); 325 module_process_thread_->Start();
327 module_process_thread_->RegisterModule(call_stats_.get()); 326 module_process_thread_->RegisterModule(call_stats_.get());
328 congestion_controller_thread_->RegisterModule(congestion_controller_.get()); 327 module_process_thread_->RegisterModule(congestion_controller_.get());
329 congestion_controller_thread_->Start(); 328 pacer_thread_->RegisterModule(congestion_controller_->pacer());
329 pacer_thread_->RegisterModule(
330 congestion_controller_->GetRemoteBitrateEstimator(true));
331 pacer_thread_->Start();
330 } 332 }
331 333
332 Call::~Call() { 334 Call::~Call() {
333 RTC_DCHECK(!remb_.InUse()); 335 RTC_DCHECK(!remb_.InUse());
334 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 336 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
335 337
336 RTC_CHECK(audio_send_ssrcs_.empty()); 338 RTC_CHECK(audio_send_ssrcs_.empty());
337 RTC_CHECK(video_send_ssrcs_.empty()); 339 RTC_CHECK(video_send_ssrcs_.empty());
338 RTC_CHECK(video_send_streams_.empty()); 340 RTC_CHECK(video_send_streams_.empty());
339 RTC_CHECK(audio_receive_ssrcs_.empty()); 341 RTC_CHECK(audio_receive_ssrcs_.empty());
340 RTC_CHECK(video_receive_ssrcs_.empty()); 342 RTC_CHECK(video_receive_ssrcs_.empty());
341 RTC_CHECK(video_receive_streams_.empty()); 343 RTC_CHECK(video_receive_streams_.empty());
342 344
343 congestion_controller_thread_->Stop(); 345 pacer_thread_->Stop();
344 congestion_controller_thread_->DeRegisterModule(congestion_controller_.get()); 346 pacer_thread_->DeRegisterModule(congestion_controller_->pacer());
347 pacer_thread_->DeRegisterModule(
348 congestion_controller_->GetRemoteBitrateEstimator(true));
349 module_process_thread_->DeRegisterModule(congestion_controller_.get());
345 module_process_thread_->DeRegisterModule(call_stats_.get()); 350 module_process_thread_->DeRegisterModule(call_stats_.get());
346 module_process_thread_->Stop(); 351 module_process_thread_->Stop();
347 call_stats_->DeregisterStatsObserver(congestion_controller_.get()); 352 call_stats_->DeregisterStatsObserver(congestion_controller_.get());
348 353
349 // Only update histograms after process threads have been shut down, so that 354 // Only update histograms after process threads have been shut down, so that
350 // they won't try to concurrently update stats. 355 // they won't try to concurrently update stats.
351 { 356 {
352 rtc::CritScope lock(&bitrate_crit_); 357 rtc::CritScope lock(&bitrate_crit_);
353 UpdateSendHistograms(); 358 UpdateSendHistograms();
354 } 359 }
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 1206
1202 void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet) { 1207 void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet) {
1203 RTPHeader header; 1208 RTPHeader header;
1204 packet.GetHeader(&header); 1209 packet.GetHeader(&header);
1205 congestion_controller_->OnReceivedPacket(packet.arrival_time_ms(), 1210 congestion_controller_->OnReceivedPacket(packet.arrival_time_ms(),
1206 packet.payload_size(), header); 1211 packet.payload_size(), header);
1207 } 1212 }
1208 1213
1209 } // namespace internal 1214 } // namespace internal
1210 } // namespace webrtc 1215 } // 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