Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Unified Diff: webrtc/voice_engine/channel.cc

Issue 2390883004: Hooking up audio network adaptor to VoE. (Closed)
Patch Set: rebasing Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698