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 30 matching lines...) Expand all Loading... |
41 *min_bitrate_bps = congestion_controller::GetMinBitrateBps(); | 41 *min_bitrate_bps = congestion_controller::GetMinBitrateBps(); |
42 if (*max_bitrate_bps > 0) | 42 if (*max_bitrate_bps > 0) |
43 *max_bitrate_bps = std::max(*min_bitrate_bps, *max_bitrate_bps); | 43 *max_bitrate_bps = std::max(*min_bitrate_bps, *max_bitrate_bps); |
44 if (*bitrate_bps > 0) | 44 if (*bitrate_bps > 0) |
45 *bitrate_bps = std::max(*min_bitrate_bps, *bitrate_bps); | 45 *bitrate_bps = std::max(*min_bitrate_bps, *bitrate_bps); |
46 } | 46 } |
47 | 47 |
48 } // namespace | 48 } // namespace |
49 | 49 |
50 CongestionController::WrappingBitrateEstimator::WrappingBitrateEstimator( | 50 CongestionController::WrappingBitrateEstimator::WrappingBitrateEstimator( |
51 RemoteBitrateObserver* observer, Clock* clock) | 51 RemoteBitrateObserver* observer, const Clock* clock) |
52 : observer_(observer), | 52 : observer_(observer), |
53 clock_(clock), | 53 clock_(clock), |
54 rbe_(new RemoteBitrateEstimatorSingleStream(observer_, clock_)), | 54 rbe_(new RemoteBitrateEstimatorSingleStream(observer_, clock_)), |
55 using_absolute_send_time_(false), | 55 using_absolute_send_time_(false), |
56 packets_since_absolute_send_time_(0), | 56 packets_since_absolute_send_time_(0), |
57 min_bitrate_bps_(congestion_controller::GetMinBitrateBps()) {} | 57 min_bitrate_bps_(congestion_controller::GetMinBitrateBps()) {} |
58 | 58 |
59 void CongestionController::WrappingBitrateEstimator::IncomingPacket( | 59 void CongestionController::WrappingBitrateEstimator::IncomingPacket( |
60 int64_t arrival_time_ms, | 60 int64_t arrival_time_ms, |
61 size_t payload_size, | 61 size_t payload_size, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 void CongestionController::WrappingBitrateEstimator::PickEstimator() { | 130 void CongestionController::WrappingBitrateEstimator::PickEstimator() { |
131 if (using_absolute_send_time_) { | 131 if (using_absolute_send_time_) { |
132 rbe_.reset(new RemoteBitrateEstimatorAbsSendTime(observer_, clock_)); | 132 rbe_.reset(new RemoteBitrateEstimatorAbsSendTime(observer_, clock_)); |
133 } else { | 133 } else { |
134 rbe_.reset(new RemoteBitrateEstimatorSingleStream(observer_, clock_)); | 134 rbe_.reset(new RemoteBitrateEstimatorSingleStream(observer_, clock_)); |
135 } | 135 } |
136 rbe_->SetMinBitrate(min_bitrate_bps_); | 136 rbe_->SetMinBitrate(min_bitrate_bps_); |
137 } | 137 } |
138 | 138 |
139 CongestionController::CongestionController( | 139 CongestionController::CongestionController( |
140 Clock* clock, | 140 const Clock* clock, |
141 Observer* observer, | 141 Observer* observer, |
142 RemoteBitrateObserver* remote_bitrate_observer, | 142 RemoteBitrateObserver* remote_bitrate_observer, |
143 RtcEventLog* event_log, | 143 RtcEventLog* event_log, |
144 PacketRouter* packet_router) | 144 PacketRouter* packet_router) |
145 : CongestionController( | 145 : CongestionController( |
146 clock, | 146 clock, |
147 observer, | 147 observer, |
148 remote_bitrate_observer, | 148 remote_bitrate_observer, |
149 event_log, | 149 event_log, |
150 packet_router, | 150 packet_router, |
151 std::unique_ptr<PacedSender>(new PacedSender(clock, packet_router))) { | 151 std::unique_ptr<PacedSender>(new PacedSender(clock, packet_router))) { |
152 } | 152 } |
153 | 153 |
154 CongestionController::CongestionController( | 154 CongestionController::CongestionController( |
155 Clock* clock, | 155 const Clock* clock, |
156 Observer* observer, | 156 Observer* observer, |
157 RemoteBitrateObserver* remote_bitrate_observer, | 157 RemoteBitrateObserver* remote_bitrate_observer, |
158 RtcEventLog* event_log, | 158 RtcEventLog* event_log, |
159 PacketRouter* packet_router, | 159 PacketRouter* packet_router, |
160 std::unique_ptr<PacedSender> pacer) | 160 std::unique_ptr<PacedSender> pacer) |
161 : clock_(clock), | 161 : clock_(clock), |
162 observer_(observer), | 162 observer_(observer), |
163 event_log_(event_log), | 163 event_log_(event_log), |
164 packet_router_(packet_router), | 164 packet_router_(packet_router), |
165 pacer_(std::move(pacer)), | 165 pacer_(std::move(pacer)), |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 bool CongestionController::IsSendQueueFull() const { | 410 bool CongestionController::IsSendQueueFull() const { |
411 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; | 411 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; |
412 } | 412 } |
413 | 413 |
414 bool CongestionController::IsNetworkDown() const { | 414 bool CongestionController::IsNetworkDown() const { |
415 rtc::CritScope cs(&network_state_lock_); | 415 rtc::CritScope cs(&network_state_lock_); |
416 return network_state_ == kNetworkDown; | 416 return network_state_ == kNetworkDown; |
417 } | 417 } |
418 | 418 |
419 } // namespace webrtc | 419 } // namespace webrtc |
OLD | NEW |