Chromium Code Reviews| 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 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1297 | 1297 |
| 1298 if (_rtpRtcpModule->SetAudioPacketSize(codec.pacsize) != 0) { | 1298 if (_rtpRtcpModule->SetAudioPacketSize(codec.pacsize) != 0) { |
| 1299 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId), | 1299 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId), |
| 1300 "SetSendCodec() failed to set audio packet size"); | 1300 "SetSendCodec() failed to set audio packet size"); |
| 1301 return -1; | 1301 return -1; |
| 1302 } | 1302 } |
| 1303 | 1303 |
| 1304 return 0; | 1304 return 0; |
| 1305 } | 1305 } |
| 1306 | 1306 |
| 1307 void Channel::SetBitRate(int bitrate_bps) { | 1307 void Channel::SetBitRate(int bitrate_bps, int64_t probing_interval_ms) { |
| 1308 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 1308 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
| 1309 "Channel::SetBitRate(bitrate_bps=%d)", bitrate_bps); | 1309 "Channel::SetBitRate(bitrate_bps=%d)", bitrate_bps); |
| 1310 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { | 1310 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
| 1311 if (*encoder) | 1311 if (*encoder) |
| 1312 (*encoder)->OnReceivedTargetAudioBitrate(bitrate_bps); | 1312 (*encoder)->OnReceivedTargetAudioBitrate(bitrate_bps); |
| 1313 }); | 1313 }); |
| 1314 retransmission_rate_limiter_->SetMaxRate(bitrate_bps); | 1314 retransmission_rate_limiter_->SetMaxRate(bitrate_bps); |
| 1315 | 1315 |
| 1316 // We give smoothed bitrate allocation to audio network adaptor as | 1316 // We give smoothed bitrate allocation to audio network adaptor as |
| 1317 // the uplink bandwidth. | 1317 // the uplink bandwidth. |
| 1318 // TODO(michaelt) : Remove kDefaultBitrateSmoothingTimeConstantMs as soon as | 1318 // The probing spikes should not affect the bitrate smoother more than 25%. |
| 1319 // we pass the probing interval to this function. | 1319 // To simplify the calculations we use a step response as input signal. |
| 1320 constexpr int64_t kDefaultBitrateSmoothingTimeConstantMs = 20000; | 1320 // The calculation show a step response for a |
|
stefan-webrtc
2016/11/24 10:40:45
for an
michaelt
2016/11/24 13:47:18
Done.
| |
| 1321 bitrate_smoother_.SetTimeConstantMs(kDefaultBitrateSmoothingTimeConstantMs); | 1321 // expensional filter (bitrate_smoother use an exponential filter) with the |
|
stefan-webrtc
2016/11/24 10:40:46
exponential
michaelt
2016/11/24 13:47:18
Done.
| |
| 1322 // length of | |
| 1323 // probing_interval and a amplitude of 1. | |
|
stefan-webrtc
2016/11/24 10:40:45
Move to the line above.
an amplitude
michaelt
2016/11/24 13:47:18
Done.
| |
| 1324 // 0.22 = 1 - e^(-t/probing_interval * 4) | t = probing_interval. | |
| 1325 bitrate_smoother_.SetTimeConstantMs(probing_interval_ms * 4); | |
| 1322 bitrate_smoother_.AddSample(bitrate_bps); | 1326 bitrate_smoother_.AddSample(bitrate_bps); |
| 1323 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { | 1327 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
| 1324 if (*encoder) { | 1328 if (*encoder) { |
| 1325 (*encoder)->OnReceivedUplinkBandwidth( | 1329 (*encoder)->OnReceivedUplinkBandwidth( |
| 1326 static_cast<int>(*bitrate_smoother_.GetAverage())); | 1330 static_cast<int>(*bitrate_smoother_.GetAverage())); |
| 1327 } | 1331 } |
| 1328 }); | 1332 }); |
| 1329 } | 1333 } |
| 1330 | 1334 |
| 1331 void Channel::OnIncomingFractionLoss(int fraction_lost) { | 1335 void Channel::OnIncomingFractionLoss(int fraction_lost) { |
| (...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3256 int64_t min_rtt = 0; | 3260 int64_t min_rtt = 0; |
| 3257 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3261 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
| 3258 0) { | 3262 0) { |
| 3259 return 0; | 3263 return 0; |
| 3260 } | 3264 } |
| 3261 return rtt; | 3265 return rtt; |
| 3262 } | 3266 } |
| 3263 | 3267 |
| 3264 } // namespace voe | 3268 } // namespace voe |
| 3265 } // namespace webrtc | 3269 } // namespace webrtc |
| OLD | NEW |