Chromium Code Reviews| Index: webrtc/voice_engine/channel.cc |
| diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc |
| index ce9770e8a461b68fa67c61ae9e17979b8199035c..ef657746c885737e674dafb071ab413216f56f3f 100644 |
| --- a/webrtc/voice_engine/channel.cc |
| +++ b/webrtc/voice_engine/channel.cc |
| @@ -48,14 +48,6 @@ namespace { |
| constexpr int64_t kMaxRetransmissionWindowMs = 1000; |
| constexpr int64_t kMinRetransmissionWindowMs = 30; |
| -bool RegisterReceiveCodec(std::unique_ptr<AudioCodingModule>* acm, |
| - acm2::RentACodec* rac, |
| - const CodecInst& ci) { |
| - const int result = (*acm)->RegisterReceiveCodec( |
| - ci, [&] { return rac->RentIsacDecoder(ci.plfreq); }); |
| - return result == 0; |
| -} |
| - |
| } // namespace |
| const int kTelephoneEventAttenuationdB = 10; |
| @@ -481,7 +473,8 @@ int32_t Channel::OnInitializeDecoder( |
| receiveCodec.pacsize = dummyCodec.pacsize; |
| // Register the new codec to the ACM |
| - if (!RegisterReceiveCodec(&audio_coding_, &rent_a_codec_, receiveCodec)) { |
| + if (!audio_coding_->RegisterReceiveCodec(receiveCodec.pltype, |
|
ossu
2016/10/05 13:39:59
Don't make a CodecInst just to convert it to an Sd
kwiberg-webrtc
2016/10/06 12:14:52
The problem is that since the caller has given us
|
| + CodecInstToSdp(receiveCodec))) { |
| WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), |
| "Channel::OnInitializeDecoder() invalid codec (" |
| "pt=%d, name=%s) received - 1", |
| @@ -1027,7 +1020,8 @@ int32_t Channel::Init() { |
| // Register default PT for outband 'telephone-event' |
| if (!STR_CASE_CMP(codec.plname, "telephone-event")) { |
| if (_rtpRtcpModule->RegisterSendPayload(codec) == -1 || |
| - !RegisterReceiveCodec(&audio_coding_, &rent_a_codec_, codec)) { |
| + !audio_coding_->RegisterReceiveCodec(codec.pltype, |
| + CodecInstToSdp(codec))) { |
| WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), |
| "Channel::Init() failed to register outband " |
| "'telephone-event' (%d/%d) correctly", |
| @@ -1038,7 +1032,8 @@ int32_t Channel::Init() { |
| if (!STR_CASE_CMP(codec.plname, "CN")) { |
| if (!codec_manager_.RegisterEncoder(codec) || |
| !codec_manager_.MakeEncoder(&rent_a_codec_, audio_coding_.get()) || |
| - !RegisterReceiveCodec(&audio_coding_, &rent_a_codec_, codec) || |
| + !audio_coding_->RegisterReceiveCodec(codec.pltype, |
| + CodecInstToSdp(codec)) || |
| _rtpRtcpModule->RegisterSendPayload(codec) == -1) { |
| WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), |
| "Channel::Init() failed to register CN (%d/%d) " |
| @@ -1387,9 +1382,11 @@ int32_t Channel::SetRecPayloadType(const CodecInst& codec) { |
| return -1; |
| } |
| } |
| - if (!RegisterReceiveCodec(&audio_coding_, &rent_a_codec_, codec)) { |
| + if (!audio_coding_->RegisterReceiveCodec(codec.pltype, |
| + CodecInstToSdp(codec))) { |
| audio_coding_->UnregisterReceiveCodec(codec.pltype); |
| - if (!RegisterReceiveCodec(&audio_coding_, &rent_a_codec_, codec)) { |
| + if (!audio_coding_->RegisterReceiveCodec(codec.pltype, |
| + CodecInstToSdp(codec))) { |
| _engineStatisticsPtr->SetLastError( |
| VE_AUDIO_CODING_MODULE_ERROR, kTraceError, |
| "SetRecPayloadType() ACM registration failed - 1"); |