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) { |
196 if (start_bitrate_bps > 0) | 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. | |
194 const int kMinBitrateBps = 10000; | |
195 if (min_bitrate_bps < kMinBitrateBps) | |
196 min_bitrate_bps = kMinBitrateBps; | |
197 if (max_bitrate_bps > 0) | |
198 max_bitrate_bps = std::max(min_bitrate_bps, max_bitrate_bps); | |
pbos-webrtc
2016/02/16 15:23:02
I think this should clamp the min bitrate instead
| |
199 if (start_bitrate_bps > 0) { | |
200 start_bitrate_bps = std::max(min_bitrate_bps, start_bitrate_bps); | |
197 bitrate_controller_->SetStartBitrate(start_bitrate_bps); | 201 bitrate_controller_->SetStartBitrate(start_bitrate_bps); |
202 } | |
198 bitrate_controller_->SetMinMaxBitrate(min_bitrate_bps, max_bitrate_bps); | 203 bitrate_controller_->SetMinMaxBitrate(min_bitrate_bps, max_bitrate_bps); |
199 if (remote_bitrate_estimator_.get()) | 204 if (remote_bitrate_estimator_.get()) |
200 remote_bitrate_estimator_->SetMinBitrate(min_bitrate_bps); | 205 remote_bitrate_estimator_->SetMinBitrate(min_bitrate_bps); |
201 if (transport_feedback_adapter_.get()) | 206 if (transport_feedback_adapter_.get()) |
202 transport_feedback_adapter_->GetBitrateEstimator()->SetMinBitrate( | 207 transport_feedback_adapter_->GetBitrateEstimator()->SetMinBitrate( |
203 min_bitrate_bps); | 208 min_bitrate_bps); |
204 min_bitrate_bps_ = min_bitrate_bps; | 209 min_bitrate_bps_ = min_bitrate_bps; |
205 } | 210 } |
206 | 211 |
207 BitrateController* CongestionController::GetBitrateController() const { | 212 BitrateController* CongestionController::GetBitrateController() const { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 } | 255 } |
251 } | 256 } |
252 | 257 |
253 void CongestionController::OnSentPacket(const rtc::SentPacket& sent_packet) { | 258 void CongestionController::OnSentPacket(const rtc::SentPacket& sent_packet) { |
254 if (transport_feedback_adapter_) { | 259 if (transport_feedback_adapter_) { |
255 transport_feedback_adapter_->OnSentPacket(sent_packet.packet_id, | 260 transport_feedback_adapter_->OnSentPacket(sent_packet.packet_id, |
256 sent_packet.send_time_ms); | 261 sent_packet.send_time_ms); |
257 } | 262 } |
258 } | 263 } |
259 } // namespace webrtc | 264 } // namespace webrtc |
OLD | NEW |