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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 namespace internal { | 242 namespace internal { |
243 | 243 |
244 Call::Call(const Call::Config& config) | 244 Call::Call(const Call::Config& config) |
245 : clock_(Clock::GetRealTimeClock()), | 245 : clock_(Clock::GetRealTimeClock()), |
246 num_cpu_cores_(CpuInfo::DetectNumberOfCores()), | 246 num_cpu_cores_(CpuInfo::DetectNumberOfCores()), |
247 module_process_thread_(ProcessThread::Create("ModuleProcessThread")), | 247 module_process_thread_(ProcessThread::Create("ModuleProcessThread")), |
248 pacer_thread_(ProcessThread::Create("PacerThread")), | 248 pacer_thread_(ProcessThread::Create("PacerThread")), |
249 call_stats_(new CallStats(clock_)), | 249 call_stats_(new CallStats(clock_)), |
250 bitrate_allocator_(new BitrateAllocator(this)), | 250 bitrate_allocator_(new BitrateAllocator(this)), |
251 config_(config), | 251 config_(config), |
252 audio_network_state_(kNetworkUp), | 252 audio_network_state_(kNetworkDown), |
253 video_network_state_(kNetworkUp), | 253 video_network_state_(kNetworkDown), |
254 receive_crit_(RWLockWrapper::CreateRWLock()), | 254 receive_crit_(RWLockWrapper::CreateRWLock()), |
255 send_crit_(RWLockWrapper::CreateRWLock()), | 255 send_crit_(RWLockWrapper::CreateRWLock()), |
256 event_log_(config.event_log), | 256 event_log_(config.event_log), |
257 first_packet_sent_ms_(-1), | 257 first_packet_sent_ms_(-1), |
258 received_bytes_per_second_counter_(clock_, nullptr, true), | 258 received_bytes_per_second_counter_(clock_, nullptr, true), |
259 received_audio_bytes_per_second_counter_(clock_, nullptr, true), | 259 received_audio_bytes_per_second_counter_(clock_, nullptr, true), |
260 received_video_bytes_per_second_counter_(clock_, nullptr, true), | 260 received_video_bytes_per_second_counter_(clock_, nullptr, true), |
261 received_rtcp_bytes_per_second_counter_(clock_, nullptr, true), | 261 received_rtcp_bytes_per_second_counter_(clock_, nullptr, true), |
262 min_allocated_send_bitrate_bps_(0), | 262 min_allocated_send_bitrate_bps_(0), |
263 configured_max_padding_bitrate_bps_(0), | 263 configured_max_padding_bitrate_bps_(0), |
(...skipping 10 matching lines...) Expand all Loading... | |
274 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); | 274 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); |
275 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, | 275 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, |
276 config.bitrate_config.min_bitrate_bps); | 276 config.bitrate_config.min_bitrate_bps); |
277 if (config.bitrate_config.max_bitrate_bps != -1) { | 277 if (config.bitrate_config.max_bitrate_bps != -1) { |
278 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, | 278 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, |
279 config.bitrate_config.start_bitrate_bps); | 279 config.bitrate_config.start_bitrate_bps); |
280 } | 280 } |
281 Trace::CreateTrace(); | 281 Trace::CreateTrace(); |
282 call_stats_->RegisterStatsObserver(congestion_controller_.get()); | 282 call_stats_->RegisterStatsObserver(congestion_controller_.get()); |
283 | 283 |
284 congestion_controller_->SignalNetworkState(kNetworkDown); | |
284 congestion_controller_->SetBweBitrates( | 285 congestion_controller_->SetBweBitrates( |
285 config_.bitrate_config.min_bitrate_bps, | 286 config_.bitrate_config.min_bitrate_bps, |
286 config_.bitrate_config.start_bitrate_bps, | 287 config_.bitrate_config.start_bitrate_bps, |
287 config_.bitrate_config.max_bitrate_bps); | 288 config_.bitrate_config.max_bitrate_bps); |
288 | 289 |
289 module_process_thread_->Start(); | 290 module_process_thread_->Start(); |
290 module_process_thread_->RegisterModule(call_stats_.get()); | 291 module_process_thread_->RegisterModule(call_stats_.get()); |
291 module_process_thread_->RegisterModule(congestion_controller_.get()); | 292 module_process_thread_->RegisterModule(congestion_controller_.get()); |
292 pacer_thread_->RegisterModule(congestion_controller_->pacer()); | 293 pacer_thread_->RegisterModule(congestion_controller_->pacer()); |
293 pacer_thread_->RegisterModule( | 294 pacer_thread_->RegisterModule( |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
688 bitrate_config.max_bitrate_bps) { | 689 bitrate_config.max_bitrate_bps) { |
689 // Nothing new to set, early abort to avoid encoder reconfigurations. | 690 // Nothing new to set, early abort to avoid encoder reconfigurations. |
690 return; | 691 return; |
691 } | 692 } |
692 config_.bitrate_config.min_bitrate_bps = bitrate_config.min_bitrate_bps; | 693 config_.bitrate_config.min_bitrate_bps = bitrate_config.min_bitrate_bps; |
693 // Start bitrate of -1 means we should keep the old bitrate, which there is | 694 // Start bitrate of -1 means we should keep the old bitrate, which there is |
694 // no point in remembering for the future. | 695 // no point in remembering for the future. |
695 if (bitrate_config.start_bitrate_bps > 0) | 696 if (bitrate_config.start_bitrate_bps > 0) |
696 config_.bitrate_config.start_bitrate_bps = bitrate_config.start_bitrate_bps; | 697 config_.bitrate_config.start_bitrate_bps = bitrate_config.start_bitrate_bps; |
697 config_.bitrate_config.max_bitrate_bps = bitrate_config.max_bitrate_bps; | 698 config_.bitrate_config.max_bitrate_bps = bitrate_config.max_bitrate_bps; |
698 congestion_controller_->SetBweBitrates(bitrate_config.min_bitrate_bps, | 699 congestion_controller_->SetBweBitrates( |
699 bitrate_config.start_bitrate_bps, | 700 config_.bitrate_config.min_bitrate_bps, |
700 bitrate_config.max_bitrate_bps); | 701 config_.bitrate_config.start_bitrate_bps, |
stefan-webrtc
2016/11/09 18:07:55
Is this a change in behavior? Did we perhaps previ
Sergey Ulanov
2016/11/09 18:34:12
Reverted this code back to what it was and added b
| |
702 config_.bitrate_config.max_bitrate_bps); | |
701 } | 703 } |
702 | 704 |
703 void Call::SignalChannelNetworkState(MediaType media, NetworkState state) { | 705 void Call::SignalChannelNetworkState(MediaType media, NetworkState state) { |
704 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 706 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
705 switch (media) { | 707 switch (media) { |
706 case MediaType::AUDIO: | 708 case MediaType::AUDIO: |
707 audio_network_state_ = state; | 709 audio_network_state_ = state; |
708 break; | 710 break; |
709 case MediaType::VIDEO: | 711 case MediaType::VIDEO: |
710 video_network_state_ = state; | 712 video_network_state_ = state; |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1037 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); | 1039 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); |
1038 ReadLockScoped read_lock(*receive_crit_); | 1040 ReadLockScoped read_lock(*receive_crit_); |
1039 auto it = video_receive_ssrcs_.find(ssrc); | 1041 auto it = video_receive_ssrcs_.find(ssrc); |
1040 if (it == video_receive_ssrcs_.end()) | 1042 if (it == video_receive_ssrcs_.end()) |
1041 return false; | 1043 return false; |
1042 return it->second->OnRecoveredPacket(packet, length); | 1044 return it->second->OnRecoveredPacket(packet, length); |
1043 } | 1045 } |
1044 | 1046 |
1045 } // namespace internal | 1047 } // namespace internal |
1046 } // namespace webrtc | 1048 } // namespace webrtc |
OLD | NEW |