Pass a real audio codec pair ID to encoders that we create

Bug: webrtc:8941
Change-Id: I0c0cb547e8424dd80b93e240bd0d40a9269bd1fc
Reviewed-on: https://webrtc-review.googlesource.com/63263
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22546}
This commit is contained in:
Karl Wiberg
2018-03-21 15:18:42 +01:00
committed by Commit Bot
parent ccd1523be4
commit 77490b95c0
3 changed files with 10 additions and 13 deletions

View File

@ -497,8 +497,8 @@ bool AudioSendStream::SetupSendCodec(AudioSendStream* stream,
RTC_DCHECK(new_config.encoder_factory);
std::unique_ptr<AudioEncoder> 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;

View File

@ -15,6 +15,7 @@
#include <string>
#include <vector>
#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<SendCodecSpec> send_codec_spec;
rtc::scoped_refptr<AudioEncoderFactory> encoder_factory;
rtc::Optional<AudioCodecPairId> codec_pair_id;
// Track ID as specified during track creation.
std::string track_id;

View File

@ -751,7 +751,8 @@ class WebRtcVoiceMediaChannel::WebRtcAudioSendStream
const rtc::Optional<std::string>& audio_network_adaptor_config,
webrtc::Call* call,
webrtc::Transport* send_transport,
const rtc::scoped_refptr<webrtc::AudioEncoderFactory>& encoder_factory)
const rtc::scoped_refptr<webrtc::AudioEncoderFactory>& encoder_factory,
const rtc::Optional<webrtc::AudioCodecPairId> 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<std::string> 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