OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 CriticalSectionScoped cs(crit_sect_.get()); | 75 CriticalSectionScoped cs(crit_sect_.get()); |
76 rbe_->RemoveStream(ssrc); | 76 rbe_->RemoveStream(ssrc); |
77 } | 77 } |
78 | 78 |
79 bool LatestEstimate(std::vector<unsigned int>* ssrcs, | 79 bool LatestEstimate(std::vector<unsigned int>* ssrcs, |
80 unsigned int* bitrate_bps) const override { | 80 unsigned int* bitrate_bps) const override { |
81 CriticalSectionScoped cs(crit_sect_.get()); | 81 CriticalSectionScoped cs(crit_sect_.get()); |
82 return rbe_->LatestEstimate(ssrcs, bitrate_bps); | 82 return rbe_->LatestEstimate(ssrcs, bitrate_bps); |
83 } | 83 } |
84 | 84 |
85 bool GetStats(ReceiveBandwidthEstimatorStats* output) const override { | |
86 CriticalSectionScoped cs(crit_sect_.get()); | |
87 return rbe_->GetStats(output); | |
88 } | |
89 | |
90 void SetMinBitrate(int min_bitrate_bps) { | 85 void SetMinBitrate(int min_bitrate_bps) { |
91 CriticalSectionScoped cs(crit_sect_.get()); | 86 CriticalSectionScoped cs(crit_sect_.get()); |
92 rbe_->SetMinBitrate(min_bitrate_bps); | 87 rbe_->SetMinBitrate(min_bitrate_bps); |
93 min_bitrate_bps_ = min_bitrate_bps; | 88 min_bitrate_bps_ = min_bitrate_bps; |
94 } | 89 } |
95 | 90 |
96 private: | 91 private: |
97 void PickEstimatorFromHeader(const RTPHeader& header) | 92 void PickEstimatorFromHeader(const RTPHeader& header) |
98 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_.get()) { | 93 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_.get()) { |
99 if (header.extension.hasAbsoluteSendTime) { | 94 if (header.extension.hasAbsoluteSendTime) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 process_thread_->DeRegisterModule(remote_bitrate_estimator_.get()); | 181 process_thread_->DeRegisterModule(remote_bitrate_estimator_.get()); |
187 call_stats_->DeregisterStatsObserver(remote_bitrate_estimator_.get()); | 182 call_stats_->DeregisterStatsObserver(remote_bitrate_estimator_.get()); |
188 if (transport_feedback_adapter_.get()) | 183 if (transport_feedback_adapter_.get()) |
189 call_stats_->DeregisterStatsObserver(transport_feedback_adapter_.get()); | 184 call_stats_->DeregisterStatsObserver(transport_feedback_adapter_.get()); |
190 } | 185 } |
191 | 186 |
192 | 187 |
193 void CongestionController::SetBweBitrates(int min_bitrate_bps, | 188 void CongestionController::SetBweBitrates(int min_bitrate_bps, |
194 int start_bitrate_bps, | 189 int start_bitrate_bps, |
195 int max_bitrate_bps) { | 190 int max_bitrate_bps) { |
191 // TODO(holmer): We should make sure the default bitrates are set to 10 kbps, | |
192 // and that we don't try to set the min bitrate to 0 from any applications. | |
193 // The congestion controller should allow a min bitrate of 0. | |
pbos-webrtc
2016/02/16 13:44:34
Should this clamp to start and max as well? All mi
stefan-webrtc
2016/02/16 14:57:16
Done.
| |
194 const int kMinBitrateBps = 10000; | |
195 if (min_bitrate_bps < kMinBitrateBps) | |
196 min_bitrate_bps = kMinBitrateBps; | |
196 if (start_bitrate_bps > 0) | 197 if (start_bitrate_bps > 0) |
197 bitrate_controller_->SetStartBitrate(start_bitrate_bps); | 198 bitrate_controller_->SetStartBitrate(start_bitrate_bps); |
198 bitrate_controller_->SetMinMaxBitrate(min_bitrate_bps, max_bitrate_bps); | 199 bitrate_controller_->SetMinMaxBitrate(min_bitrate_bps, max_bitrate_bps); |
199 if (remote_bitrate_estimator_.get()) | 200 if (remote_bitrate_estimator_.get()) |
200 remote_bitrate_estimator_->SetMinBitrate(min_bitrate_bps); | 201 remote_bitrate_estimator_->SetMinBitrate(min_bitrate_bps); |
201 if (transport_feedback_adapter_.get()) | 202 if (transport_feedback_adapter_.get()) |
202 transport_feedback_adapter_->GetBitrateEstimator()->SetMinBitrate( | 203 transport_feedback_adapter_->GetBitrateEstimator()->SetMinBitrate( |
203 min_bitrate_bps); | 204 min_bitrate_bps); |
204 min_bitrate_bps_ = min_bitrate_bps; | 205 min_bitrate_bps_ = min_bitrate_bps; |
205 } | 206 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 } | 251 } |
251 } | 252 } |
252 | 253 |
253 void CongestionController::OnSentPacket(const rtc::SentPacket& sent_packet) { | 254 void CongestionController::OnSentPacket(const rtc::SentPacket& sent_packet) { |
254 if (transport_feedback_adapter_) { | 255 if (transport_feedback_adapter_) { |
255 transport_feedback_adapter_->OnSentPacket(sent_packet.packet_id, | 256 transport_feedback_adapter_->OnSentPacket(sent_packet.packet_id, |
256 sent_packet.send_time_ms); | 257 sent_packet.send_time_ms); |
257 } | 258 } |
258 } | 259 } |
259 } // namespace webrtc | 260 } // namespace webrtc |
OLD | NEW |