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

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

Issue 2106183002: Fix bug where min transmit bitrate wasn't working (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Stats contain current configured min bitrate Created 4 years, 5 months 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 int64_t last_rtp_packet_received_ms_; 174 int64_t last_rtp_packet_received_ms_;
175 int64_t first_packet_sent_ms_; 175 int64_t first_packet_sent_ms_;
176 176
177 // TODO(holmer): Remove this lock once BitrateController no longer calls 177 // TODO(holmer): Remove this lock once BitrateController no longer calls
178 // OnNetworkChanged from multiple threads. 178 // OnNetworkChanged from multiple threads.
179 rtc::CriticalSection bitrate_crit_; 179 rtc::CriticalSection bitrate_crit_;
180 int64_t estimated_send_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_); 180 int64_t estimated_send_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_);
181 int64_t pacer_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_); 181 int64_t pacer_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_);
182 uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_); 182 uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_);
183 int64_t num_bitrate_updates_ GUARDED_BY(&bitrate_crit_); 183 int64_t num_bitrate_updates_ GUARDED_BY(&bitrate_crit_);
184 uint32_t configured_min_transmit_bitrate_bps_ GUARDED_BY(&bitrate_crit_);
184 185
185 std::map<std::string, rtc::NetworkRoute> network_routes_; 186 std::map<std::string, rtc::NetworkRoute> network_routes_;
186 187
187 VieRemb remb_; 188 VieRemb remb_;
188 const std::unique_ptr<CongestionController> congestion_controller_; 189 const std::unique_ptr<CongestionController> congestion_controller_;
189 const std::unique_ptr<SendDelayStats> video_send_delay_stats_; 190 const std::unique_ptr<SendDelayStats> video_send_delay_stats_;
190 191
191 RTC_DISALLOW_COPY_AND_ASSIGN(Call); 192 RTC_DISALLOW_COPY_AND_ASSIGN(Call);
192 }; 193 };
193 } // namespace internal 194 } // namespace internal
(...skipping 19 matching lines...) Expand all
213 received_video_bytes_(0), 214 received_video_bytes_(0),
214 received_audio_bytes_(0), 215 received_audio_bytes_(0),
215 received_rtcp_bytes_(0), 216 received_rtcp_bytes_(0),
216 first_rtp_packet_received_ms_(-1), 217 first_rtp_packet_received_ms_(-1),
217 last_rtp_packet_received_ms_(-1), 218 last_rtp_packet_received_ms_(-1),
218 first_packet_sent_ms_(-1), 219 first_packet_sent_ms_(-1),
219 estimated_send_bitrate_sum_kbits_(0), 220 estimated_send_bitrate_sum_kbits_(0),
220 pacer_bitrate_sum_kbits_(0), 221 pacer_bitrate_sum_kbits_(0),
221 min_allocated_send_bitrate_bps_(0), 222 min_allocated_send_bitrate_bps_(0),
222 num_bitrate_updates_(0), 223 num_bitrate_updates_(0),
224 configured_min_transmit_bitrate_bps_(0),
225
223 remb_(clock_), 226 remb_(clock_),
224 congestion_controller_(new CongestionController(clock_, this, &remb_)), 227 congestion_controller_(new CongestionController(clock_, this, &remb_)),
225 video_send_delay_stats_(new SendDelayStats(clock_)) { 228 video_send_delay_stats_(new SendDelayStats(clock_)) {
226 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 229 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
227 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); 230 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0);
228 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, 231 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps,
229 config.bitrate_config.min_bitrate_bps); 232 config.bitrate_config.min_bitrate_bps);
230 if (config.bitrate_config.max_bitrate_bps != -1) { 233 if (config.bitrate_config.max_bitrate_bps != -1) {
231 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, 234 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps,
232 config.bitrate_config.start_bitrate_bps); 235 config.bitrate_config.start_bitrate_bps);
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 congestion_controller_->GetBitrateController()->AvailableBandwidth( 545 congestion_controller_->GetBitrateController()->AvailableBandwidth(
543 &send_bandwidth); 546 &send_bandwidth);
544 std::vector<unsigned int> ssrcs; 547 std::vector<unsigned int> ssrcs;
545 uint32_t recv_bandwidth = 0; 548 uint32_t recv_bandwidth = 0;
546 congestion_controller_->GetRemoteBitrateEstimator(false)->LatestEstimate( 549 congestion_controller_->GetRemoteBitrateEstimator(false)->LatestEstimate(
547 &ssrcs, &recv_bandwidth); 550 &ssrcs, &recv_bandwidth);
548 stats.send_bandwidth_bps = send_bandwidth; 551 stats.send_bandwidth_bps = send_bandwidth;
549 stats.recv_bandwidth_bps = recv_bandwidth; 552 stats.recv_bandwidth_bps = recv_bandwidth;
550 stats.pacer_delay_ms = congestion_controller_->GetPacerQueuingDelayMs(); 553 stats.pacer_delay_ms = congestion_controller_->GetPacerQueuingDelayMs();
551 stats.rtt_ms = call_stats_->rtcp_rtt_stats()->LastProcessedRtt(); 554 stats.rtt_ms = call_stats_->rtcp_rtt_stats()->LastProcessedRtt();
555 {
556 rtc::CritScope cs(&bitrate_crit_);
557 stats.min_transmit_bitrate_bps = configured_min_transmit_bitrate_bps_;
558 }
552 return stats; 559 return stats;
553 } 560 }
554 561
555 void Call::SetBitrateConfig( 562 void Call::SetBitrateConfig(
556 const webrtc::Call::Config::BitrateConfig& bitrate_config) { 563 const webrtc::Call::Config::BitrateConfig& bitrate_config) {
557 TRACE_EVENT0("webrtc", "Call::SetBitrateConfig"); 564 TRACE_EVENT0("webrtc", "Call::SetBitrateConfig");
558 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 565 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
559 RTC_DCHECK_GE(bitrate_config.min_bitrate_bps, 0); 566 RTC_DCHECK_GE(bitrate_config.min_bitrate_bps, 0);
560 if (bitrate_config.max_bitrate_bps != -1) 567 if (bitrate_config.max_bitrate_bps != -1)
561 RTC_DCHECK_GT(bitrate_config.max_bitrate_bps, 0); 568 RTC_DCHECK_GT(bitrate_config.max_bitrate_bps, 0);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 ++num_bitrate_updates_; 711 ++num_bitrate_updates_;
705 } 712 }
706 } 713 }
707 714
708 void Call::OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps, 715 void Call::OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps,
709 uint32_t max_padding_bitrate_bps) { 716 uint32_t max_padding_bitrate_bps) {
710 congestion_controller_->SetAllocatedSendBitrateLimits( 717 congestion_controller_->SetAllocatedSendBitrateLimits(
711 min_send_bitrate_bps, max_padding_bitrate_bps); 718 min_send_bitrate_bps, max_padding_bitrate_bps);
712 rtc::CritScope lock(&bitrate_crit_); 719 rtc::CritScope lock(&bitrate_crit_);
713 min_allocated_send_bitrate_bps_ = min_send_bitrate_bps; 720 min_allocated_send_bitrate_bps_ = min_send_bitrate_bps;
721 configured_min_transmit_bitrate_bps_ = max_padding_bitrate_bps;
714 } 722 }
715 723
716 void Call::ConfigureSync(const std::string& sync_group) { 724 void Call::ConfigureSync(const std::string& sync_group) {
717 // Set sync only if there was no previous one. 725 // Set sync only if there was no previous one.
718 if (voice_engine() == nullptr || sync_group.empty()) 726 if (voice_engine() == nullptr || sync_group.empty())
719 return; 727 return;
720 728
721 AudioReceiveStream* sync_audio_stream = nullptr; 729 AudioReceiveStream* sync_audio_stream = nullptr;
722 // Find existing audio stream. 730 // Find existing audio stream.
723 const auto it = sync_stream_mapping_.find(sync_group); 731 const auto it = sync_stream_mapping_.find(sync_group);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 // thread. Then this check can be enabled. 865 // thread. Then this check can be enabled.
858 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); 866 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread());
859 if (RtpHeaderParser::IsRtcp(packet, length)) 867 if (RtpHeaderParser::IsRtcp(packet, length))
860 return DeliverRtcp(media_type, packet, length); 868 return DeliverRtcp(media_type, packet, length);
861 869
862 return DeliverRtp(media_type, packet, length, packet_time); 870 return DeliverRtp(media_type, packet, length, packet_time);
863 } 871 }
864 872
865 } // namespace internal 873 } // namespace internal
866 } // namespace webrtc 874 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698