diff options
author | turaj@webrtc.org <turaj@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-01-31 18:20:17 +0000 |
---|---|---|
committer | turaj@webrtc.org <turaj@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-01-31 18:20:17 +0000 |
commit | 040f800277e94794897f61a5afe7a276dc12251f (patch) | |
tree | 1c3c66eac8c3796b460d2cd33a0de51fc57a7e6c /voice_engine | |
parent | d206d5ad989a4f1ea641beec1555e868ffb0b4e8 (diff) | |
download | webrtc-040f800277e94794897f61a5afe7a276dc12251f.tar.gz |
fix issue 1322, accept -1 as default payload-type for redundant coding (FEC).
issue=1322
test=trybot, voe auto-tes
Review URL: https://webrtc-codereview.appspot.com/1043007
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@3446 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'voice_engine')
-rw-r--r-- | voice_engine/channel.cc | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/voice_engine/channel.cc b/voice_engine/channel.cc index 468b2bc7..1ffc4d00 100644 --- a/voice_engine/channel.cc +++ b/voice_engine/channel.cc @@ -5598,11 +5598,20 @@ int Channel::SetFECStatus(bool enable, int redPayloadtype) { WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), "Channel::SetFECStatus()"); - if (SetRedPayloadType(redPayloadtype) < 0) { - _engineStatisticsPtr->SetLastError( - VE_CODEC_ERROR, kTraceError, - "SetSecondarySendCodec() Failed to register RED ACM"); - return -1; + if (enable) { + if (redPayloadtype < 0 || redPayloadtype > 127) { + _engineStatisticsPtr->SetLastError( + VE_PLTYPE_ERROR, kTraceError, + "SetFECStatus() invalid RED payload type"); + return -1; + } + + if (SetRedPayloadType(redPayloadtype) < 0) { + _engineStatisticsPtr->SetLastError( + VE_CODEC_ERROR, kTraceError, + "SetSecondarySendCodec() Failed to register RED ACM"); + return -1; + } } if (_audioCodingModule.SetFECStatus(enable) != 0) { @@ -6631,6 +6640,14 @@ int Channel::ApmProcessRx(AudioFrame& frame) { int Channel::SetSecondarySendCodec(const CodecInst& codec, int red_payload_type) { + // Sanity check for payload type. + if (red_payload_type < 0 || red_payload_type > 127) { + _engineStatisticsPtr->SetLastError( + VE_PLTYPE_ERROR, kTraceError, + "SetRedPayloadType() invalid RED payload type"); + return -1; + } + if (SetRedPayloadType(red_payload_type) < 0) { _engineStatisticsPtr->SetLastError( VE_AUDIO_CODING_MODULE_ERROR, kTraceError, @@ -6662,14 +6679,8 @@ int Channel::GetSecondarySendCodec(CodecInst* codec) { return 0; } +// Assuming this method is called with valid payload type. int Channel::SetRedPayloadType(int red_payload_type) { - if (red_payload_type < 0) { - _engineStatisticsPtr->SetLastError( - VE_PLTYPE_ERROR, kTraceError, - "SetRedPayloadType() invalid RED payload type"); - return -1; - } - CodecInst codec; bool found_red = false; @@ -6690,7 +6701,6 @@ int Channel::SetRedPayloadType(int red_payload_type) { return -1; } - codec.pltype = red_payload_type; if (_audioCodingModule.RegisterSendCodec(codec) < 0) { _engineStatisticsPtr->SetLastError( VE_AUDIO_CODING_MODULE_ERROR, kTraceError, |