OLD | NEW |
---|---|
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 return nullptr; | 114 return nullptr; |
115 } | 115 } |
116 | 116 |
117 void UpdateSendHistograms() EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_); | 117 void UpdateSendHistograms() EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_); |
118 void UpdateReceiveHistograms(); | 118 void UpdateReceiveHistograms(); |
119 | 119 |
120 Clock* const clock_; | 120 Clock* const clock_; |
121 | 121 |
122 const int num_cpu_cores_; | 122 const int num_cpu_cores_; |
123 const rtc::scoped_ptr<ProcessThread> module_process_thread_; | 123 const rtc::scoped_ptr<ProcessThread> module_process_thread_; |
124 const rtc::scoped_ptr<ProcessThread> pacer_thread_; | |
124 const rtc::scoped_ptr<CallStats> call_stats_; | 125 const rtc::scoped_ptr<CallStats> call_stats_; |
125 const rtc::scoped_ptr<BitrateAllocator> bitrate_allocator_; | 126 const rtc::scoped_ptr<BitrateAllocator> bitrate_allocator_; |
126 Call::Config config_; | 127 Call::Config config_; |
127 rtc::ThreadChecker configuration_thread_checker_; | 128 rtc::ThreadChecker configuration_thread_checker_; |
128 | 129 |
129 bool network_enabled_; | 130 bool network_enabled_; |
130 | 131 |
131 rtc::scoped_ptr<RWLockWrapper> receive_crit_; | 132 rtc::scoped_ptr<RWLockWrapper> receive_crit_; |
132 // Audio and Video receive streams are owned by the client that creates them. | 133 // Audio and Video receive streams are owned by the client that creates them. |
133 std::map<uint32_t, AudioReceiveStream*> audio_receive_ssrcs_ | 134 std::map<uint32_t, AudioReceiveStream*> audio_receive_ssrcs_ |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 Call* Call::Create(const Call::Config& config) { | 177 Call* Call::Create(const Call::Config& config) { |
177 return new internal::Call(config); | 178 return new internal::Call(config); |
178 } | 179 } |
179 | 180 |
180 namespace internal { | 181 namespace internal { |
181 | 182 |
182 Call::Call(const Call::Config& config) | 183 Call::Call(const Call::Config& config) |
183 : clock_(Clock::GetRealTimeClock()), | 184 : clock_(Clock::GetRealTimeClock()), |
184 num_cpu_cores_(CpuInfo::DetectNumberOfCores()), | 185 num_cpu_cores_(CpuInfo::DetectNumberOfCores()), |
185 module_process_thread_(ProcessThread::Create("ModuleProcessThread")), | 186 module_process_thread_(ProcessThread::Create("ModuleProcessThread")), |
187 pacer_thread_(ProcessThread::Create("PacerThread")), | |
186 call_stats_(new CallStats(clock_)), | 188 call_stats_(new CallStats(clock_)), |
187 bitrate_allocator_(new BitrateAllocator()), | 189 bitrate_allocator_(new BitrateAllocator()), |
188 config_(config), | 190 config_(config), |
189 network_enabled_(true), | 191 network_enabled_(true), |
190 receive_crit_(RWLockWrapper::CreateRWLock()), | 192 receive_crit_(RWLockWrapper::CreateRWLock()), |
191 send_crit_(RWLockWrapper::CreateRWLock()), | 193 send_crit_(RWLockWrapper::CreateRWLock()), |
192 received_video_bytes_(0), | 194 received_video_bytes_(0), |
193 received_audio_bytes_(0), | 195 received_audio_bytes_(0), |
194 received_rtcp_bytes_(0), | 196 received_rtcp_bytes_(0), |
195 first_rtp_packet_received_ms_(-1), | 197 first_rtp_packet_received_ms_(-1), |
(...skipping 14 matching lines...) Expand all Loading... | |
210 } | 212 } |
211 if (config.audio_state.get()) { | 213 if (config.audio_state.get()) { |
212 ScopedVoEInterface<VoECodec> voe_codec(voice_engine()); | 214 ScopedVoEInterface<VoECodec> voe_codec(voice_engine()); |
213 event_log_ = voe_codec->GetEventLog(); | 215 event_log_ = voe_codec->GetEventLog(); |
214 } | 216 } |
215 | 217 |
216 Trace::CreateTrace(); | 218 Trace::CreateTrace(); |
217 module_process_thread_->Start(); | 219 module_process_thread_->Start(); |
218 module_process_thread_->RegisterModule(call_stats_.get()); | 220 module_process_thread_->RegisterModule(call_stats_.get()); |
219 module_process_thread_->RegisterModule(congestion_controller_.get()); | 221 module_process_thread_->RegisterModule(congestion_controller_.get()); |
222 pacer_thread_->RegisterModule(congestion_controller_->pacer()); | |
223 pacer_thread_->RegisterModule( | |
224 congestion_controller_->GetRemoteBitrateEstimator(true)); | |
225 pacer_thread_->Start(); | |
pbos-webrtc
2016/02/24 14:52:13
Move to end of block so the controller settings ar
| |
220 call_stats_->RegisterStatsObserver(congestion_controller_.get()); | 226 call_stats_->RegisterStatsObserver(congestion_controller_.get()); |
221 | 227 |
222 congestion_controller_->SetBweBitrates( | 228 congestion_controller_->SetBweBitrates( |
223 config_.bitrate_config.min_bitrate_bps, | 229 config_.bitrate_config.min_bitrate_bps, |
224 config_.bitrate_config.start_bitrate_bps, | 230 config_.bitrate_config.start_bitrate_bps, |
225 config_.bitrate_config.max_bitrate_bps); | 231 config_.bitrate_config.max_bitrate_bps); |
226 | 232 |
227 congestion_controller_->GetBitrateController()->SetEventLog(event_log_); | 233 congestion_controller_->GetBitrateController()->SetEventLog(event_log_); |
228 } | 234 } |
229 | 235 |
230 Call::~Call() { | 236 Call::~Call() { |
231 RTC_DCHECK(!remb_.InUse()); | 237 RTC_DCHECK(!remb_.InUse()); |
232 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 238 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
233 UpdateSendHistograms(); | 239 UpdateSendHistograms(); |
234 UpdateReceiveHistograms(); | 240 UpdateReceiveHistograms(); |
235 RTC_CHECK(audio_send_ssrcs_.empty()); | 241 RTC_CHECK(audio_send_ssrcs_.empty()); |
236 RTC_CHECK(video_send_ssrcs_.empty()); | 242 RTC_CHECK(video_send_ssrcs_.empty()); |
237 RTC_CHECK(video_send_streams_.empty()); | 243 RTC_CHECK(video_send_streams_.empty()); |
238 RTC_CHECK(audio_receive_ssrcs_.empty()); | 244 RTC_CHECK(audio_receive_ssrcs_.empty()); |
239 RTC_CHECK(video_receive_ssrcs_.empty()); | 245 RTC_CHECK(video_receive_ssrcs_.empty()); |
240 RTC_CHECK(video_receive_streams_.empty()); | 246 RTC_CHECK(video_receive_streams_.empty()); |
241 | 247 |
242 call_stats_->DeregisterStatsObserver(congestion_controller_.get()); | 248 call_stats_->DeregisterStatsObserver(congestion_controller_.get()); |
249 pacer_thread_->Stop(); | |
250 pacer_thread_->DeRegisterModule(congestion_controller_->pacer()); | |
251 pacer_thread_->DeRegisterModule( | |
252 congestion_controller_->GetRemoteBitrateEstimator(true)); | |
243 module_process_thread_->DeRegisterModule(congestion_controller_.get()); | 253 module_process_thread_->DeRegisterModule(congestion_controller_.get()); |
244 module_process_thread_->DeRegisterModule(call_stats_.get()); | 254 module_process_thread_->DeRegisterModule(call_stats_.get()); |
245 module_process_thread_->Stop(); | 255 module_process_thread_->Stop(); |
246 Trace::ReturnTrace(); | 256 Trace::ReturnTrace(); |
247 } | 257 } |
248 | 258 |
249 void Call::UpdateSendHistograms() { | 259 void Call::UpdateSendHistograms() { |
250 if (num_bitrate_updates_ == 0 || first_packet_sent_ms_ == -1) | 260 if (num_bitrate_updates_ == 0 || first_packet_sent_ms_ == -1) |
251 return; | 261 return; |
252 int64_t elapsed_sec = | 262 int64_t elapsed_sec = |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
734 // thread. Then this check can be enabled. | 744 // thread. Then this check can be enabled. |
735 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); | 745 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); |
736 if (RtpHeaderParser::IsRtcp(packet, length)) | 746 if (RtpHeaderParser::IsRtcp(packet, length)) |
737 return DeliverRtcp(media_type, packet, length); | 747 return DeliverRtcp(media_type, packet, length); |
738 | 748 |
739 return DeliverRtp(media_type, packet, length, packet_time); | 749 return DeliverRtp(media_type, packet, length, packet_time); |
740 } | 750 } |
741 | 751 |
742 } // namespace internal | 752 } // namespace internal |
743 } // namespace webrtc | 753 } // namespace webrtc |
OLD | NEW |