Index: webrtc/voice_engine/channel.cc |
diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc |
index ce9770e8a461b68fa67c61ae9e17979b8199035c..03d2ccb21efdab99e955161e51fbbc5388bbcea9 100644 |
--- a/webrtc/voice_engine/channel.cc |
+++ b/webrtc/voice_engine/channel.cc |
@@ -1285,19 +1285,22 @@ int32_t Channel::SetSendCodec(const CodecInst& codec) { |
void Channel::SetBitRate(int bitrate_bps) { |
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
"Channel::SetBitRate(bitrate_bps=%d)", bitrate_bps); |
- audio_coding_->SetBitRate(bitrate_bps); |
+ audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
michaelt
2016/10/11 11:38:40
Have you done a real call with this ?
ModifyEncode
minyue-webrtc
2016/10/11 11:59:21
I think this should work. But thank you for bring
|
+ if (*encoder) |
+ (*encoder)->OnReceivedTargetAudioBitrate(bitrate_bps); |
+ }); |
retransmission_rate_limiter_->SetMaxRate(bitrate_bps); |
} |
void Channel::OnIncomingFractionLoss(int fraction_lost) { |
network_predictor_->UpdatePacketLossRate(fraction_lost); |
uint8_t average_fraction_loss = network_predictor_->GetLossRate(); |
michaelt
2016/10/11 11:38:40
shouldn't we remove this double smoothing for ANA
minyue-webrtc
2016/10/11 11:59:21
Good question. Now the forking between using old S
michaelt
2016/10/11 12:27:23
Moving |network_predictor_| to the encoder and smo
|
- |
- // Normalizes rate to 0 - 100. |
- if (audio_coding_->SetPacketLossRate(100 * average_fraction_loss / 255) != |
- 0) { |
- assert(false); // This should not happen. |
- } |
+ audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
+ if (*encoder) { |
+ (*encoder)->OnReceivedUplinkPacketLossFraction(average_fraction_loss / |
+ 255.0f); |
+ } |
+ }); |
} |
int32_t Channel::SetVADStatus(bool enableVAD, |
@@ -1494,6 +1497,34 @@ int Channel::GetOpusDtx(bool* enabled) { |
return success; |
} |
+bool Channel::EnableAudioNetworkAdaptor(const std::string& config_string) { |
+ bool success = false; |
+ audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
+ if (*encoder) { |
+ success = (*encoder)->EnableAudioNetworkAdaptor( |
+ config_string, Clock::GetRealTimeClock()); |
+ } |
+ }); |
+ return success; |
+} |
+ |
+void Channel::DisableAudioNetworkAdaptor() { |
+ audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
+ if (*encoder) |
+ (*encoder)->DisableAudioNetworkAdaptor(); |
+ }); |
+} |
+ |
+void Channel::SetReceiverFrameLengthRange(int min_frame_length_ms, |
+ int max_frame_length_ms) { |
+ audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
+ if (*encoder) { |
+ (*encoder)->SetReceiverFrameLengthRange(min_frame_length_ms, |
+ max_frame_length_ms); |
+ } |
+ }); |
+} |
+ |
int32_t Channel::RegisterExternalTransport(Transport* transport) { |
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
"Channel::RegisterExternalTransport()"); |
@@ -1654,6 +1685,12 @@ int32_t Channel::ReceivedRTCPPacket(const uint8_t* data, size_t length) { |
} |
retransmission_rate_limiter_->SetWindowSize(nack_window_ms); |
+ // Invoke audio encoders OnReceivedRtt(). |
+ audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
+ if (*encoder) |
+ (*encoder)->OnReceivedRtt(rtt); |
+ }); |
+ |
uint32_t ntp_secs = 0; |
uint32_t ntp_frac = 0; |
uint32_t rtp_timestamp = 0; |