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

Unified Diff: webrtc/voice_engine/channel.cc

Issue 2390883004: Hooking up audio network adaptor to VoE. (Closed)
Patch Set: adding a comment 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') | webrtc/voice_engine/network_predictor.h » ('j') | 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..861aabec95f57a3a1be4022dbd258a70e75b2c03 100644
--- a/webrtc/voice_engine/channel.cc
+++ b/webrtc/voice_engine/channel.cc
@@ -854,7 +854,6 @@ Channel::Channel(int32_t channelId,
_outputSpeechType(AudioFrame::kNormalSpeech),
restored_packet_in_use_(false),
rtcp_observer_(new VoERtcpObserver(this)),
- network_predictor_(new NetworkPredictor(Clock::GetRealTimeClock())),
associate_send_channel_(ChannelOwner(nullptr)),
pacing_enabled_(config.enable_voice_pacing),
feedback_observer_proxy_(new TransportFeedbackProxy()),
@@ -1285,19 +1284,18 @@ 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) {
+ 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();
-
- // 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(fraction_lost / 255.0f);
+ });
}
int32_t Channel::SetVADStatus(bool enableVAD,
@@ -1494,6 +1492,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 +1680,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') | webrtc/voice_engine/network_predictor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698