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, int 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 bitrate_smoother_.SetTimeConstantMs(probing_interval_ms * 4); |
minyue-webrtc
2016/11/22 10:14:25
add some reason of choosing 4
michaelt
2016/11/22 16:29:00
Done.
| |
1319 // we pass the probing interval to this function. | |
1320 constexpr int64_t kDefaultBitrateSmoothingTimeConstantMs = 20000; | |
1321 bitrate_smoother_.SetTimeConstantMs(kDefaultBitrateSmoothingTimeConstantMs); | |
1322 bitrate_smoother_.AddSample(bitrate_bps); | 1319 bitrate_smoother_.AddSample(bitrate_bps); |
1323 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { | 1320 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
1324 if (*encoder) { | 1321 if (*encoder) { |
1325 (*encoder)->OnReceivedUplinkBandwidth( | 1322 (*encoder)->OnReceivedUplinkBandwidth( |
1326 static_cast<int>(*bitrate_smoother_.GetAverage())); | 1323 static_cast<int>(*bitrate_smoother_.GetAverage())); |
1327 } | 1324 } |
1328 }); | 1325 }); |
1329 } | 1326 } |
1330 | 1327 |
1331 void Channel::OnIncomingFractionLoss(int fraction_lost) { | 1328 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; | 3253 int64_t min_rtt = 0; |
3257 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3254 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
3258 0) { | 3255 0) { |
3259 return 0; | 3256 return 0; |
3260 } | 3257 } |
3261 return rtt; | 3258 return rtt; |
3262 } | 3259 } |
3263 | 3260 |
3264 } // namespace voe | 3261 } // namespace voe |
3265 } // namespace webrtc | 3262 } // namespace webrtc |
OLD | NEW |