Index: webrtc/voice_engine/channel.cc |
diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc |
index 5aba65afcc95c805b72c65e290edbd612374ccbe..de31564d9393d110c3cb54c79a02858b87dad84b 100644 |
--- a/webrtc/voice_engine/channel.cc |
+++ b/webrtc/voice_engine/channel.cc |
@@ -1345,6 +1345,11 @@ int32_t Channel::GetVADStatus(bool& enabledVAD, |
} |
int32_t Channel::SetRecPayloadType(const CodecInst& codec) { |
+ return SetRecPayloadType(codec.pltype, CodecInstToSdp(codec)); |
+} |
+ |
+int32_t Channel::SetRecPayloadType(int payload_type, |
+ const SdpAudioFormat& format) { |
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
"Channel::SetRecPayloadType()"); |
@@ -1355,15 +1360,17 @@ int32_t Channel::SetRecPayloadType(const CodecInst& codec) { |
return -1; |
} |
- if (codec.pltype == -1) { |
+ const CodecInst codec = SdpToCodecInst(payload_type, format); |
+ |
+ if (payload_type == -1) { |
// De-register the selected codec (RTP/RTCP module and ACM) |
int8_t pltype(-1); |
CodecInst rxCodec = codec; |
// Get payload type for the given codec |
- rtp_payload_registry_->ReceivePayloadType(rxCodec.plname, rxCodec.plfreq, |
- rxCodec.channels, &pltype); |
+ rtp_payload_registry_->ReceivePayloadType( |
+ format.name.c_str(), rxCodec.plfreq, rxCodec.channels, &pltype); |
rxCodec.pltype = pltype; |
if (rtp_receiver_->DeRegisterReceivePayload(pltype) != 0) { |
@@ -1398,11 +1405,9 @@ int32_t Channel::SetRecPayloadType(const CodecInst& codec) { |
return -1; |
} |
} |
- if (!audio_coding_->RegisterReceiveCodec(codec.pltype, |
- CodecInstToSdp(codec))) { |
- audio_coding_->UnregisterReceiveCodec(codec.pltype); |
- if (!audio_coding_->RegisterReceiveCodec(codec.pltype, |
- CodecInstToSdp(codec))) { |
+ if (!audio_coding_->RegisterReceiveCodec(payload_type, format)) { |
+ audio_coding_->UnregisterReceiveCodec(payload_type); |
+ if (!audio_coding_->RegisterReceiveCodec(payload_type, format)) { |
_engineStatisticsPtr->SetLastError( |
VE_AUDIO_CODING_MODULE_ERROR, kTraceError, |
"SetRecPayloadType() ACM registration failed - 1"); |