| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 void SignalNetworkState(NetworkState state) override; | 78 void SignalNetworkState(NetworkState state) override; |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 DeliveryStatus DeliverRtcp(MediaType media_type, const uint8_t* packet, | 81 DeliveryStatus DeliverRtcp(MediaType media_type, const uint8_t* packet, |
| 82 size_t length); | 82 size_t length); |
| 83 DeliveryStatus DeliverRtp(MediaType media_type, | 83 DeliveryStatus DeliverRtp(MediaType media_type, |
| 84 const uint8_t* packet, | 84 const uint8_t* packet, |
| 85 size_t length, | 85 size_t length, |
| 86 const PacketTime& packet_time); | 86 const PacketTime& packet_time); |
| 87 | 87 |
| 88 void SetBitrateControllerConfig( | |
| 89 const webrtc::Call::Config::BitrateConfig& bitrate_config); | |
| 90 | |
| 91 void ConfigureSync(const std::string& sync_group) | 88 void ConfigureSync(const std::string& sync_group) |
| 92 EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); | 89 EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); |
| 93 | 90 |
| 94 const int num_cpu_cores_; | 91 const int num_cpu_cores_; |
| 95 const rtc::scoped_ptr<ProcessThread> module_process_thread_; | 92 const rtc::scoped_ptr<ProcessThread> module_process_thread_; |
| 96 const rtc::scoped_ptr<ChannelGroup> channel_group_; | 93 const rtc::scoped_ptr<ChannelGroup> channel_group_; |
| 97 volatile int next_channel_id_; | 94 volatile int next_channel_id_; |
| 98 Call::Config config_; | 95 Call::Config config_; |
| 99 | 96 |
| 100 // Needs to be held while write-locking |receive_crit_| or |send_crit_|. This | 97 // Needs to be held while write-locking |receive_crit_| or |send_crit_|. This |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 VoECodec* voe_codec = VoECodec::GetInterface(config.voice_engine); | 149 VoECodec* voe_codec = VoECodec::GetInterface(config.voice_engine); |
| 153 if (voe_codec) { | 150 if (voe_codec) { |
| 154 event_log_ = voe_codec->GetEventLog(); | 151 event_log_ = voe_codec->GetEventLog(); |
| 155 voe_codec->Release(); | 152 voe_codec->Release(); |
| 156 } | 153 } |
| 157 } | 154 } |
| 158 | 155 |
| 159 Trace::CreateTrace(); | 156 Trace::CreateTrace(); |
| 160 module_process_thread_->Start(); | 157 module_process_thread_->Start(); |
| 161 | 158 |
| 162 SetBitrateControllerConfig(config_.bitrate_config); | 159 channel_group_->SetBweBitrates(config_.bitrate_config.min_bitrate_bps, |
| 160 config_.bitrate_config.start_bitrate_bps, |
| 161 config_.bitrate_config.max_bitrate_bps); |
| 163 } | 162 } |
| 164 | 163 |
| 165 Call::~Call() { | 164 Call::~Call() { |
| 166 RTC_CHECK_EQ(0u, video_send_ssrcs_.size()); | 165 RTC_CHECK_EQ(0u, video_send_ssrcs_.size()); |
| 167 RTC_CHECK_EQ(0u, video_send_streams_.size()); | 166 RTC_CHECK_EQ(0u, video_send_streams_.size()); |
| 168 RTC_CHECK_EQ(0u, audio_receive_ssrcs_.size()); | 167 RTC_CHECK_EQ(0u, audio_receive_ssrcs_.size()); |
| 169 RTC_CHECK_EQ(0u, video_receive_ssrcs_.size()); | 168 RTC_CHECK_EQ(0u, video_receive_ssrcs_.size()); |
| 170 RTC_CHECK_EQ(0u, video_receive_streams_.size()); | 169 RTC_CHECK_EQ(0u, video_receive_streams_.size()); |
| 171 | 170 |
| 172 module_process_thread_->Stop(); | 171 module_process_thread_->Stop(); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 bitrate_config.min_bitrate_bps && | 379 bitrate_config.min_bitrate_bps && |
| 381 (bitrate_config.start_bitrate_bps <= 0 || | 380 (bitrate_config.start_bitrate_bps <= 0 || |
| 382 config_.bitrate_config.start_bitrate_bps == | 381 config_.bitrate_config.start_bitrate_bps == |
| 383 bitrate_config.start_bitrate_bps) && | 382 bitrate_config.start_bitrate_bps) && |
| 384 config_.bitrate_config.max_bitrate_bps == | 383 config_.bitrate_config.max_bitrate_bps == |
| 385 bitrate_config.max_bitrate_bps) { | 384 bitrate_config.max_bitrate_bps) { |
| 386 // Nothing new to set, early abort to avoid encoder reconfigurations. | 385 // Nothing new to set, early abort to avoid encoder reconfigurations. |
| 387 return; | 386 return; |
| 388 } | 387 } |
| 389 config_.bitrate_config = bitrate_config; | 388 config_.bitrate_config = bitrate_config; |
| 390 SetBitrateControllerConfig(bitrate_config); | 389 channel_group_->SetBweBitrates(bitrate_config.min_bitrate_bps, |
| 391 } | 390 bitrate_config.start_bitrate_bps, |
| 392 | 391 bitrate_config.max_bitrate_bps); |
| 393 void Call::SetBitrateControllerConfig( | |
| 394 const webrtc::Call::Config::BitrateConfig& bitrate_config) { | |
| 395 BitrateController* bitrate_controller = | |
| 396 channel_group_->GetBitrateController(); | |
| 397 if (bitrate_config.start_bitrate_bps > 0) | |
| 398 bitrate_controller->SetStartBitrate(bitrate_config.start_bitrate_bps); | |
| 399 bitrate_controller->SetMinMaxBitrate(bitrate_config.min_bitrate_bps, | |
| 400 bitrate_config.max_bitrate_bps); | |
| 401 } | 392 } |
| 402 | 393 |
| 403 void Call::SignalNetworkState(NetworkState state) { | 394 void Call::SignalNetworkState(NetworkState state) { |
| 404 // Take crit for entire function, it needs to be held while updating streams | 395 // Take crit for entire function, it needs to be held while updating streams |
| 405 // to guarantee a consistent state across streams. | 396 // to guarantee a consistent state across streams. |
| 406 rtc::CritScope lock(&network_enabled_crit_); | 397 rtc::CritScope lock(&network_enabled_crit_); |
| 407 network_enabled_ = state == kNetworkUp; | 398 network_enabled_ = state == kNetworkUp; |
| 408 { | 399 { |
| 409 ReadLockScoped write_lock(*send_crit_); | 400 ReadLockScoped write_lock(*send_crit_); |
| 410 for (auto& kv : video_send_ssrcs_) { | 401 for (auto& kv : video_send_ssrcs_) { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 size_t length, | 531 size_t length, |
| 541 const PacketTime& packet_time) { | 532 const PacketTime& packet_time) { |
| 542 if (RtpHeaderParser::IsRtcp(packet, length)) | 533 if (RtpHeaderParser::IsRtcp(packet, length)) |
| 543 return DeliverRtcp(media_type, packet, length); | 534 return DeliverRtcp(media_type, packet, length); |
| 544 | 535 |
| 545 return DeliverRtp(media_type, packet, length, packet_time); | 536 return DeliverRtp(media_type, packet, length, packet_time); |
| 546 } | 537 } |
| 547 | 538 |
| 548 } // namespace internal | 539 } // namespace internal |
| 549 } // namespace webrtc | 540 } // namespace webrtc |
| OLD | NEW |