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

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

Issue 2580843002: Change return type of CongestionController::pacer() method.
Patch Set: Created 4 years 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) 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 void UpdateSendHistograms() EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_); 157 void UpdateSendHistograms() EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_);
158 void UpdateReceiveHistograms(); 158 void UpdateReceiveHistograms();
159 void UpdateHistograms(); 159 void UpdateHistograms();
160 void UpdateAggregateNetworkState(); 160 void UpdateAggregateNetworkState();
161 161
162 Clock* const clock_; 162 Clock* const clock_;
163 163
164 const int num_cpu_cores_; 164 const int num_cpu_cores_;
165 const std::unique_ptr<ProcessThread> module_process_thread_; 165 const std::unique_ptr<ProcessThread> module_process_thread_;
166 const std::unique_ptr<ProcessThread> pacer_thread_;
167 const std::unique_ptr<CallStats> call_stats_; 166 const std::unique_ptr<CallStats> call_stats_;
168 const std::unique_ptr<BitrateAllocator> bitrate_allocator_; 167 const std::unique_ptr<BitrateAllocator> bitrate_allocator_;
169 Call::Config config_; 168 Call::Config config_;
170 rtc::ThreadChecker configuration_thread_checker_; 169 rtc::ThreadChecker configuration_thread_checker_;
171 170
172 NetworkState audio_network_state_; 171 NetworkState audio_network_state_;
173 NetworkState video_network_state_; 172 NetworkState video_network_state_;
174 173
175 std::unique_ptr<RWLockWrapper> receive_crit_; 174 std::unique_ptr<RWLockWrapper> receive_crit_;
176 // Audio, Video, and FlexFEC receive streams are owned by the client that 175 // Audio, Video, and FlexFEC receive streams are owned by the client that
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 Call* Call::Create(const Call::Config& config) { 251 Call* Call::Create(const Call::Config& config) {
253 return new internal::Call(config); 252 return new internal::Call(config);
254 } 253 }
255 254
256 namespace internal { 255 namespace internal {
257 256
258 Call::Call(const Call::Config& config) 257 Call::Call(const Call::Config& config)
259 : clock_(Clock::GetRealTimeClock()), 258 : clock_(Clock::GetRealTimeClock()),
260 num_cpu_cores_(CpuInfo::DetectNumberOfCores()), 259 num_cpu_cores_(CpuInfo::DetectNumberOfCores()),
261 module_process_thread_(ProcessThread::Create("ModuleProcessThread")), 260 module_process_thread_(ProcessThread::Create("ModuleProcessThread")),
262 pacer_thread_(ProcessThread::Create("PacerThread")),
263 call_stats_(new CallStats(clock_)), 261 call_stats_(new CallStats(clock_)),
264 bitrate_allocator_(new BitrateAllocator(this)), 262 bitrate_allocator_(new BitrateAllocator(this)),
265 config_(config), 263 config_(config),
266 audio_network_state_(kNetworkDown), 264 audio_network_state_(kNetworkDown),
267 video_network_state_(kNetworkDown), 265 video_network_state_(kNetworkDown),
268 receive_crit_(RWLockWrapper::CreateRWLock()), 266 receive_crit_(RWLockWrapper::CreateRWLock()),
269 send_crit_(RWLockWrapper::CreateRWLock()), 267 send_crit_(RWLockWrapper::CreateRWLock()),
270 event_log_(config.event_log), 268 event_log_(config.event_log),
271 first_packet_sent_ms_(-1), 269 first_packet_sent_ms_(-1),
272 received_bytes_per_second_counter_(clock_, nullptr, true), 270 received_bytes_per_second_counter_(clock_, nullptr, true),
(...skipping 27 matching lines...) Expand all
300 298
301 congestion_controller_->SignalNetworkState(kNetworkDown); 299 congestion_controller_->SignalNetworkState(kNetworkDown);
302 congestion_controller_->SetBweBitrates( 300 congestion_controller_->SetBweBitrates(
303 config_.bitrate_config.min_bitrate_bps, 301 config_.bitrate_config.min_bitrate_bps,
304 config_.bitrate_config.start_bitrate_bps, 302 config_.bitrate_config.start_bitrate_bps,
305 config_.bitrate_config.max_bitrate_bps); 303 config_.bitrate_config.max_bitrate_bps);
306 304
307 module_process_thread_->Start(); 305 module_process_thread_->Start();
308 module_process_thread_->RegisterModule(call_stats_.get()); 306 module_process_thread_->RegisterModule(call_stats_.get());
309 module_process_thread_->RegisterModule(congestion_controller_.get()); 307 module_process_thread_->RegisterModule(congestion_controller_.get());
310 pacer_thread_->RegisterModule(congestion_controller_->pacer());
311 pacer_thread_->RegisterModule(
312 congestion_controller_->GetRemoteBitrateEstimator(true));
313 pacer_thread_->Start();
314 } 308 }
315 309
316 Call::~Call() { 310 Call::~Call() {
317 RTC_DCHECK(!remb_.InUse()); 311 RTC_DCHECK(!remb_.InUse());
318 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 312 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
319 313
320 RTC_CHECK(audio_send_ssrcs_.empty()); 314 RTC_CHECK(audio_send_ssrcs_.empty());
321 RTC_CHECK(video_send_ssrcs_.empty()); 315 RTC_CHECK(video_send_ssrcs_.empty());
322 RTC_CHECK(video_send_streams_.empty()); 316 RTC_CHECK(video_send_streams_.empty());
323 RTC_CHECK(audio_receive_ssrcs_.empty()); 317 RTC_CHECK(audio_receive_ssrcs_.empty());
324 RTC_CHECK(video_receive_ssrcs_.empty()); 318 RTC_CHECK(video_receive_ssrcs_.empty());
325 RTC_CHECK(video_receive_streams_.empty()); 319 RTC_CHECK(video_receive_streams_.empty());
326 320
327 pacer_thread_->Stop();
the sun 2016/12/15 15:11:32 Are there any subtle relationship issues between t
nisse-webrtc 2016/12/16 09:38:13 Don't know... Does the call object register any ca
stefan-webrtc 2016/12/22 09:54:58 I don't think it does. It calls into rtp modules a
328 pacer_thread_->DeRegisterModule(congestion_controller_->pacer());
329 pacer_thread_->DeRegisterModule(
330 congestion_controller_->GetRemoteBitrateEstimator(true));
331 module_process_thread_->DeRegisterModule(congestion_controller_.get()); 321 module_process_thread_->DeRegisterModule(congestion_controller_.get());
332 module_process_thread_->DeRegisterModule(call_stats_.get()); 322 module_process_thread_->DeRegisterModule(call_stats_.get());
333 module_process_thread_->Stop(); 323 module_process_thread_->Stop();
334 call_stats_->DeregisterStatsObserver(congestion_controller_.get()); 324 call_stats_->DeregisterStatsObserver(congestion_controller_.get());
335 325
336 // Only update histograms after process threads have been shut down, so that 326 // Only update histograms after process threads have been shut down, so that
337 // they won't try to concurrently update stats. 327 // they won't try to concurrently update stats.
338 { 328 {
339 rtc::CritScope lock(&bitrate_crit_); 329 rtc::CritScope lock(&bitrate_crit_);
340 UpdateSendHistograms(); 330 UpdateSendHistograms();
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); 1112 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]);
1123 ReadLockScoped read_lock(*receive_crit_); 1113 ReadLockScoped read_lock(*receive_crit_);
1124 auto it = video_receive_ssrcs_.find(ssrc); 1114 auto it = video_receive_ssrcs_.find(ssrc);
1125 if (it == video_receive_ssrcs_.end()) 1115 if (it == video_receive_ssrcs_.end())
1126 return false; 1116 return false;
1127 return it->second->OnRecoveredPacket(packet, length); 1117 return it->second->OnRecoveredPacket(packet, length);
1128 } 1118 }
1129 1119
1130 } // namespace internal 1120 } // namespace internal
1131 } // namespace webrtc 1121 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698