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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 int64_t last_rtp_packet_received_ms_; | 182 int64_t last_rtp_packet_received_ms_; |
183 int64_t first_packet_sent_ms_; | 183 int64_t first_packet_sent_ms_; |
184 | 184 |
185 // TODO(holmer): Remove this lock once BitrateController no longer calls | 185 // TODO(holmer): Remove this lock once BitrateController no longer calls |
186 // OnNetworkChanged from multiple threads. | 186 // OnNetworkChanged from multiple threads. |
187 rtc::CriticalSection bitrate_crit_; | 187 rtc::CriticalSection bitrate_crit_; |
188 int64_t estimated_send_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_); | 188 int64_t estimated_send_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_); |
189 int64_t pacer_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_); | 189 int64_t pacer_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_); |
190 uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_); | 190 uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_); |
191 int64_t num_bitrate_updates_ GUARDED_BY(&bitrate_crit_); | 191 int64_t num_bitrate_updates_ GUARDED_BY(&bitrate_crit_); |
| 192 uint32_t configured_max_padding_bitrate_bps_ GUARDED_BY(&bitrate_crit_); |
192 | 193 |
193 std::map<std::string, rtc::NetworkRoute> network_routes_; | 194 std::map<std::string, rtc::NetworkRoute> network_routes_; |
194 | 195 |
195 VieRemb remb_; | 196 VieRemb remb_; |
196 const std::unique_ptr<CongestionController> congestion_controller_; | 197 const std::unique_ptr<CongestionController> congestion_controller_; |
197 const std::unique_ptr<SendDelayStats> video_send_delay_stats_; | 198 const std::unique_ptr<SendDelayStats> video_send_delay_stats_; |
198 | 199 |
199 RTC_DISALLOW_COPY_AND_ASSIGN(Call); | 200 RTC_DISALLOW_COPY_AND_ASSIGN(Call); |
200 }; | 201 }; |
201 } // namespace internal | 202 } // namespace internal |
(...skipping 20 matching lines...) Expand all Loading... |
222 received_video_bytes_(0), | 223 received_video_bytes_(0), |
223 received_audio_bytes_(0), | 224 received_audio_bytes_(0), |
224 received_rtcp_bytes_(0), | 225 received_rtcp_bytes_(0), |
225 first_rtp_packet_received_ms_(-1), | 226 first_rtp_packet_received_ms_(-1), |
226 last_rtp_packet_received_ms_(-1), | 227 last_rtp_packet_received_ms_(-1), |
227 first_packet_sent_ms_(-1), | 228 first_packet_sent_ms_(-1), |
228 estimated_send_bitrate_sum_kbits_(0), | 229 estimated_send_bitrate_sum_kbits_(0), |
229 pacer_bitrate_sum_kbits_(0), | 230 pacer_bitrate_sum_kbits_(0), |
230 min_allocated_send_bitrate_bps_(0), | 231 min_allocated_send_bitrate_bps_(0), |
231 num_bitrate_updates_(0), | 232 num_bitrate_updates_(0), |
| 233 configured_max_padding_bitrate_bps_(0), |
| 234 |
232 remb_(clock_), | 235 remb_(clock_), |
233 congestion_controller_( | 236 congestion_controller_( |
234 new CongestionController(clock_, this, &remb_, event_log_.get())), | 237 new CongestionController(clock_, this, &remb_, event_log_.get())), |
235 video_send_delay_stats_(new SendDelayStats(clock_)) { | 238 video_send_delay_stats_(new SendDelayStats(clock_)) { |
236 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 239 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
237 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); | 240 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); |
238 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, | 241 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, |
239 config.bitrate_config.min_bitrate_bps); | 242 config.bitrate_config.min_bitrate_bps); |
240 if (config.bitrate_config.max_bitrate_bps != -1) { | 243 if (config.bitrate_config.max_bitrate_bps != -1) { |
241 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, | 244 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 congestion_controller_->GetBitrateController()->AvailableBandwidth( | 548 congestion_controller_->GetBitrateController()->AvailableBandwidth( |
546 &send_bandwidth); | 549 &send_bandwidth); |
547 std::vector<unsigned int> ssrcs; | 550 std::vector<unsigned int> ssrcs; |
548 uint32_t recv_bandwidth = 0; | 551 uint32_t recv_bandwidth = 0; |
549 congestion_controller_->GetRemoteBitrateEstimator(false)->LatestEstimate( | 552 congestion_controller_->GetRemoteBitrateEstimator(false)->LatestEstimate( |
550 &ssrcs, &recv_bandwidth); | 553 &ssrcs, &recv_bandwidth); |
551 stats.send_bandwidth_bps = send_bandwidth; | 554 stats.send_bandwidth_bps = send_bandwidth; |
552 stats.recv_bandwidth_bps = recv_bandwidth; | 555 stats.recv_bandwidth_bps = recv_bandwidth; |
553 stats.pacer_delay_ms = congestion_controller_->GetPacerQueuingDelayMs(); | 556 stats.pacer_delay_ms = congestion_controller_->GetPacerQueuingDelayMs(); |
554 stats.rtt_ms = call_stats_->rtcp_rtt_stats()->LastProcessedRtt(); | 557 stats.rtt_ms = call_stats_->rtcp_rtt_stats()->LastProcessedRtt(); |
| 558 { |
| 559 rtc::CritScope cs(&bitrate_crit_); |
| 560 stats.max_padding_bitrate_bps = configured_max_padding_bitrate_bps_; |
| 561 } |
555 return stats; | 562 return stats; |
556 } | 563 } |
557 | 564 |
558 void Call::SetBitrateConfig( | 565 void Call::SetBitrateConfig( |
559 const webrtc::Call::Config::BitrateConfig& bitrate_config) { | 566 const webrtc::Call::Config::BitrateConfig& bitrate_config) { |
560 TRACE_EVENT0("webrtc", "Call::SetBitrateConfig"); | 567 TRACE_EVENT0("webrtc", "Call::SetBitrateConfig"); |
561 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 568 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
562 RTC_DCHECK_GE(bitrate_config.min_bitrate_bps, 0); | 569 RTC_DCHECK_GE(bitrate_config.min_bitrate_bps, 0); |
563 if (bitrate_config.max_bitrate_bps != -1) | 570 if (bitrate_config.max_bitrate_bps != -1) |
564 RTC_DCHECK_GT(bitrate_config.max_bitrate_bps, 0); | 571 RTC_DCHECK_GT(bitrate_config.max_bitrate_bps, 0); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 ++num_bitrate_updates_; | 714 ++num_bitrate_updates_; |
708 } | 715 } |
709 } | 716 } |
710 | 717 |
711 void Call::OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps, | 718 void Call::OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps, |
712 uint32_t max_padding_bitrate_bps) { | 719 uint32_t max_padding_bitrate_bps) { |
713 congestion_controller_->SetAllocatedSendBitrateLimits( | 720 congestion_controller_->SetAllocatedSendBitrateLimits( |
714 min_send_bitrate_bps, max_padding_bitrate_bps); | 721 min_send_bitrate_bps, max_padding_bitrate_bps); |
715 rtc::CritScope lock(&bitrate_crit_); | 722 rtc::CritScope lock(&bitrate_crit_); |
716 min_allocated_send_bitrate_bps_ = min_send_bitrate_bps; | 723 min_allocated_send_bitrate_bps_ = min_send_bitrate_bps; |
| 724 configured_max_padding_bitrate_bps_ = max_padding_bitrate_bps; |
717 } | 725 } |
718 | 726 |
719 void Call::ConfigureSync(const std::string& sync_group) { | 727 void Call::ConfigureSync(const std::string& sync_group) { |
720 // Set sync only if there was no previous one. | 728 // Set sync only if there was no previous one. |
721 if (voice_engine() == nullptr || sync_group.empty()) | 729 if (voice_engine() == nullptr || sync_group.empty()) |
722 return; | 730 return; |
723 | 731 |
724 AudioReceiveStream* sync_audio_stream = nullptr; | 732 AudioReceiveStream* sync_audio_stream = nullptr; |
725 // Find existing audio stream. | 733 // Find existing audio stream. |
726 const auto it = sync_stream_mapping_.find(sync_group); | 734 const auto it = sync_stream_mapping_.find(sync_group); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 // thread. Then this check can be enabled. | 868 // thread. Then this check can be enabled. |
861 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); | 869 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); |
862 if (RtpHeaderParser::IsRtcp(packet, length)) | 870 if (RtpHeaderParser::IsRtcp(packet, length)) |
863 return DeliverRtcp(media_type, packet, length); | 871 return DeliverRtcp(media_type, packet, length); |
864 | 872 |
865 return DeliverRtp(media_type, packet, length, packet_time); | 873 return DeliverRtp(media_type, packet, length, packet_time); |
866 } | 874 } |
867 | 875 |
868 } // namespace internal | 876 } // namespace internal |
869 } // namespace webrtc | 877 } // namespace webrtc |
OLD | NEW |