diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc index 8ff34ed55a..71a4319fd6 100644 --- a/audio/audio_send_stream.cc +++ b/audio/audio_send_stream.cc @@ -497,8 +497,8 @@ bool AudioSendStream::SetupSendCodec(AudioSendStream* stream, RTC_DCHECK(new_config.encoder_factory); std::unique_ptr encoder = - new_config.encoder_factory->MakeAudioEncoder(spec.payload_type, - spec.format, rtc::nullopt); + new_config.encoder_factory->MakeAudioEncoder( + spec.payload_type, spec.format, new_config.codec_pair_id); if (!encoder) { RTC_DLOG(LS_ERROR) << "Unable to create encoder for " << spec.format; diff --git a/call/audio_send_stream.h b/call/audio_send_stream.h index 908da11f6d..f84c6cb90b 100644 --- a/call/audio_send_stream.h +++ b/call/audio_send_stream.h @@ -15,6 +15,7 @@ #include #include +#include "api/audio_codecs/audio_codec_pair_id.h" #include "api/audio_codecs/audio_encoder.h" #include "api/audio_codecs/audio_encoder_factory.h" #include "api/audio_codecs/audio_format.h" @@ -120,6 +121,7 @@ class AudioSendStream { rtc::Optional send_codec_spec; rtc::scoped_refptr encoder_factory; + rtc::Optional codec_pair_id; // Track ID as specified during track creation. std::string track_id; diff --git a/media/engine/webrtcvoiceengine.cc b/media/engine/webrtcvoiceengine.cc index 809ea5408c..04f299779b 100644 --- a/media/engine/webrtcvoiceengine.cc +++ b/media/engine/webrtcvoiceengine.cc @@ -751,7 +751,8 @@ class WebRtcVoiceMediaChannel::WebRtcAudioSendStream const rtc::Optional& audio_network_adaptor_config, webrtc::Call* call, webrtc::Transport* send_transport, - const rtc::scoped_refptr& encoder_factory) + const rtc::scoped_refptr& encoder_factory, + const rtc::Optional codec_pair_id) : call_(call), config_(send_transport), send_side_bwe_with_overhead_( @@ -765,6 +766,7 @@ class WebRtcVoiceMediaChannel::WebRtcAudioSendStream config_.rtp.extensions = extensions; config_.audio_network_adaptor_config = audio_network_adaptor_config; config_.encoder_factory = encoder_factory; + config_.codec_pair_id = codec_pair_id; config_.track_id = track_id; rtp_parameters_.encodings[0].ssrc = ssrc; @@ -1766,16 +1768,9 @@ bool WebRtcVoiceMediaChannel::AddSendStream(const StreamParams& sp) { rtc::Optional audio_network_adaptor_config = GetAudioNetworkAdaptorConfig(options_); WebRtcAudioSendStream* stream = new WebRtcAudioSendStream( - ssrc, - sp.cname, - sp.id, - send_codec_spec_, - send_rtp_extensions_, - max_send_bitrate_bps_, - audio_network_adaptor_config, - call_, - this, - engine()->encoder_factory_); + ssrc, sp.cname, sp.id, send_codec_spec_, send_rtp_extensions_, + max_send_bitrate_bps_, audio_network_adaptor_config, call_, this, + engine()->encoder_factory_, codec_pair_id_); send_streams_.insert(std::make_pair(ssrc, stream)); // At this point the stream's local SSRC has been updated. If it is the first