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 an |
| 1321 bitrate_smoother_.SetTimeConstantMs(kDefaultBitrateSmoothingTimeConstantMs); | 1321 // exponential filter (bitrate_smoother use an exponential filter) with the |
|
minyue-webrtc
2016/11/28 12:00:00
merge this line with up
michaelt
2016/11/28 13:03:38
Changed description according to the offline discu
| |
| 1322 // length of probing_interval and an amplitude of 1. | |
|
minyue-webrtc
2016/11/28 12:00:00
and put |var| around variables, no need in equatio
michaelt
2016/11/28 13:03:37
Changed description according to the offline discu
| |
| 1323 // 0.22 = 1 - e^(-t/probing_interval * 4) | t = probing_interval. | |
| 1324 bitrate_smoother_.SetTimeConstantMs(probing_interval_ms * 4); | |
| 1322 bitrate_smoother_.AddSample(bitrate_bps); | 1325 bitrate_smoother_.AddSample(bitrate_bps); |
| 1323 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { | 1326 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
| 1324 if (*encoder) { | 1327 if (*encoder) { |
| 1325 (*encoder)->OnReceivedUplinkBandwidth( | 1328 (*encoder)->OnReceivedUplinkBandwidth( |
| 1326 static_cast<int>(*bitrate_smoother_.GetAverage())); | 1329 static_cast<int>(*bitrate_smoother_.GetAverage())); |
| 1327 } | 1330 } |
| 1328 }); | 1331 }); |
| 1329 } | 1332 } |
| 1330 | 1333 |
| 1331 void Channel::OnIncomingFractionLoss(int fraction_lost) { | 1334 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; | 3259 int64_t min_rtt = 0; |
| 3257 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3260 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
| 3258 0) { | 3261 0) { |
| 3259 return 0; | 3262 return 0; |
| 3260 } | 3263 } |
| 3261 return rtt; | 3264 return rtt; |
| 3262 } | 3265 } |
| 3263 | 3266 |
| 3264 } // namespace voe | 3267 } // namespace voe |
| 3265 } // namespace webrtc | 3268 } // namespace webrtc |
| OLD | NEW |