Index: webrtc/media/engine/webrtcvoiceengine.cc |
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc |
index 7c6d7940f685cd9e11aa4f90227b93582ccf6ce0..31a9d27184c785e40d286779b1e1199b4c3e7d12 100644 |
--- a/webrtc/media/engine/webrtcvoiceengine.cc |
+++ b/webrtc/media/engine/webrtcvoiceengine.cc |
@@ -132,13 +132,6 @@ std::string ToString(const AudioCodec& codec) { |
return ss.str(); |
} |
-std::string ToString(const webrtc::CodecInst& codec) { |
- std::stringstream ss; |
- ss << codec.plname << "/" << codec.plfreq << "/" << codec.channels |
- << " (" << codec.pltype << ")"; |
- return ss.str(); |
-} |
- |
bool IsCodec(const AudioCodec& codec, const char* ref_name) { |
return (_stricmp(codec.name.c_str(), ref_name) == 0); |
} |
@@ -1466,7 +1459,8 @@ class WebRtcVoiceMediaChannel::WebRtcAudioReceiveStream { |
const std::vector<webrtc::RtpExtension>& extensions, |
webrtc::Call* call, |
webrtc::Transport* rtcp_send_transport, |
- const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory) |
+ const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, |
+ const std::map<int, webrtc::SdpAudioFormat>& decoder_map) |
: call_(call), config_() { |
RTC_DCHECK_GE(ch, 0); |
RTC_DCHECK(call); |
@@ -1479,6 +1473,7 @@ class WebRtcVoiceMediaChannel::WebRtcAudioReceiveStream { |
config_.voe_channel_id = ch; |
config_.sync_group = sync_group; |
config_.decoder_factory = decoder_factory; |
+ config_.decoder_map = decoder_map; |
RecreateAudioReceiveStream(); |
} |
@@ -1867,8 +1862,9 @@ bool WebRtcVoiceMediaChannel::SetRecvCodecs( |
ChangePlayout(false); |
} |
+ decoder_map_ = std::move(decoder_map); |
for (auto& kv : recv_streams_) { |
- kv.second->RecreateAudioReceiveStream(decoder_map); |
+ kv.second->RecreateAudioReceiveStream(decoder_map_); |
} |
recv_codecs_ = codecs; |
@@ -2225,38 +2221,12 @@ bool WebRtcVoiceMediaChannel::AddRecvStream(const StreamParams& sp) { |
return false; |
} |
- // Turn off all supported codecs. |
- // TODO(solenberg): Remove once "no codecs" is the default state of a stream. |
- for (webrtc::CodecInst voe_codec : webrtc::acm2::RentACodec::Database()) { |
- voe_codec.pltype = -1; |
- if (engine()->voe()->codec()->SetRecPayloadType(channel, voe_codec) == -1) { |
- LOG_RTCERR2(SetRecPayloadType, channel, ToString(voe_codec)); |
- DeleteVoEChannel(channel); |
- return false; |
- } |
- } |
- |
- // Only enable those configured for this channel. |
- for (const auto& codec : recv_codecs_) { |
- webrtc::CodecInst voe_codec = {0}; |
- if (WebRtcVoiceEngine::ToCodecInst(codec, &voe_codec)) { |
- voe_codec.pltype = codec.id; |
- if (engine()->voe()->codec()->SetRecPayloadType( |
- channel, voe_codec) == -1) { |
- LOG_RTCERR2(SetRecPayloadType, channel, ToString(voe_codec)); |
- DeleteVoEChannel(channel); |
- return false; |
- } |
- } |
- } |
- |
recv_streams_.insert(std::make_pair( |
- ssrc, new WebRtcAudioReceiveStream(channel, ssrc, receiver_reports_ssrc_, |
- recv_transport_cc_enabled_, |
- recv_nack_enabled_, |
- sp.sync_label, recv_rtp_extensions_, |
- call_, this, |
- engine()->decoder_factory_))); |
+ ssrc, |
+ new WebRtcAudioReceiveStream( |
+ channel, ssrc, receiver_reports_ssrc_, recv_transport_cc_enabled_, |
+ recv_nack_enabled_, sp.sync_label, recv_rtp_extensions_, call_, this, |
+ engine()->decoder_factory_, decoder_map_))); |
recv_streams_[ssrc]->SetPlayout(playout_); |
return true; |