Voice Engine: Remove RED support
It was already disabled for browsers by design, and for everyone else
because of a bug.
BUG=webrtc:5922
Review-Url: https://codereview.webrtc.org/2055493003
Cr-Commit-Position: refs/heads/master@{#13138}
diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc
index 6ec0012..d879fe8 100644
--- a/webrtc/voice_engine/channel.cc
+++ b/webrtc/voice_engine/channel.cc
@@ -1029,18 +1029,6 @@
codec.pltype, codec.plfreq);
}
}
-#ifdef WEBRTC_CODEC_RED
- // Register RED to the receiving side of the ACM.
- // We will not receive an OnInitializeDecoder() callback for RED.
- if (!STR_CASE_CMP(codec.plname, "RED")) {
- if (!RegisterReceiveCodec(&audio_coding_, &rent_a_codec_, codec)) {
- WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId),
- "Channel::Init() failed to register RED (%d/%d) "
- "correctly",
- codec.pltype, codec.plfreq);
- }
- }
-#endif
}
if (rx_audioproc_->noise_suppression()->set_level(kDefaultNsMode) != 0) {
@@ -2880,53 +2868,6 @@
return 0;
}
-int Channel::SetREDStatus(bool enable, int redPayloadtype) {
- WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
- "Channel::SetREDStatus()");
-
- if (enable) {
- if (redPayloadtype < 0 || redPayloadtype > 127) {
- _engineStatisticsPtr->SetLastError(
- VE_PLTYPE_ERROR, kTraceError,
- "SetREDStatus() 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 (!codec_manager_.SetCopyRed(enable) ||
- !codec_manager_.MakeEncoder(&rent_a_codec_, audio_coding_.get())) {
- _engineStatisticsPtr->SetLastError(
- VE_AUDIO_CODING_MODULE_ERROR, kTraceError,
- "SetREDStatus() failed to set RED state in the ACM");
- return -1;
- }
- return 0;
-}
-
-int Channel::GetREDStatus(bool& enabled, int& redPayloadtype) {
- enabled = codec_manager_.GetStackParams()->use_red;
- if (enabled) {
- int8_t payloadType = 0;
- if (_rtpRtcpModule->SendREDPayloadType(&payloadType) != 0) {
- _engineStatisticsPtr->SetLastError(
- VE_RTP_RTCP_MODULE_ERROR, kTraceError,
- "GetREDStatus() failed to retrieve RED PT from RTP/RTCP "
- "module");
- return -1;
- }
- redPayloadtype = payloadType;
- return 0;
- }
- return 0;
-}
-
int Channel::SetCodecFECStatus(bool enable) {
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
"Channel::SetCodecFECStatus()");
@@ -3467,46 +3408,6 @@
}
}
-// Assuming this method is called with valid payload type.
-int Channel::SetRedPayloadType(int red_payload_type) {
- CodecInst codec;
- bool found_red = false;
-
- // Get default RED settings from the ACM database
- const int num_codecs = AudioCodingModule::NumberOfCodecs();
- for (int idx = 0; idx < num_codecs; idx++) {
- audio_coding_->Codec(idx, &codec);
- if (!STR_CASE_CMP(codec.plname, "RED")) {
- found_red = true;
- break;
- }
- }
-
- if (!found_red) {
- _engineStatisticsPtr->SetLastError(
- VE_CODEC_ERROR, kTraceError,
- "SetRedPayloadType() RED is not supported");
- return -1;
- }
-
- codec.pltype = red_payload_type;
- if (!codec_manager_.RegisterEncoder(codec) ||
- !codec_manager_.MakeEncoder(&rent_a_codec_, audio_coding_.get())) {
- _engineStatisticsPtr->SetLastError(
- VE_AUDIO_CODING_MODULE_ERROR, kTraceError,
- "SetRedPayloadType() RED registration in ACM module failed");
- return -1;
- }
-
- if (_rtpRtcpModule->SetSendREDPayloadType(red_payload_type) != 0) {
- _engineStatisticsPtr->SetLastError(
- VE_RTP_RTCP_MODULE_ERROR, kTraceError,
- "SetRedPayloadType() RED registration in RTP/RTCP module failed");
- return -1;
- }
- return 0;
-}
-
int Channel::SetSendRtpHeaderExtension(bool enable,
RTPExtensionType type,
unsigned char id) {
diff --git a/webrtc/voice_engine/channel.h b/webrtc/voice_engine/channel.h
index 5f1d7f2..9b6a2a1 100644
--- a/webrtc/voice_engine/channel.h
+++ b/webrtc/voice_engine/channel.h
@@ -367,8 +367,6 @@
unsigned int& discardedPackets);
int GetRemoteRTCPReportBlocks(std::vector<ReportBlock>* report_blocks);
int GetRTPStatistics(CallStatistics& stats);
- int SetREDStatus(bool enable, int redPayloadtype);
- int GetREDStatus(bool& enabled, int& redPayloadtype);
int SetCodecFECStatus(bool enable);
bool GetCodecFECStatus();
void SetNACKStatus(bool enable, int maxNumberOfPackets);
@@ -473,7 +471,6 @@
void UpdatePacketDelay(uint32_t timestamp, uint16_t sequenceNumber);
void RegisterReceiveCodecsToRTPModule();
- int SetRedPayloadType(int red_payload_type);
int SetSendRtpHeaderExtension(bool enable,
RTPExtensionType type,
unsigned char id);
diff --git a/webrtc/voice_engine/voe_rtp_rtcp_impl.cc b/webrtc/voice_engine/voe_rtp_rtcp_impl.cc
index ab70fee..8f3fcb6 100644
--- a/webrtc/voice_engine/voe_rtp_rtcp_impl.cc
+++ b/webrtc/voice_engine/voe_rtp_rtcp_impl.cc
@@ -365,47 +365,17 @@
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"SetREDStatus(channel=%d, enable=%d, redPayloadtype=%d)",
channel, enable, redPayloadtype);
-#ifdef WEBRTC_CODEC_RED
- if (!_shared->statistics().Initialized()) {
- _shared->SetLastError(VE_NOT_INITED, kTraceError);
- return -1;
- }
- voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
- voe::Channel* channelPtr = ch.channel();
- if (channelPtr == NULL) {
- _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
- "SetREDStatus() failed to locate channel");
- return -1;
- }
- return channelPtr->SetREDStatus(enable, redPayloadtype);
-#else
_shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
"SetREDStatus() RED is not supported");
return -1;
-#endif
}
int VoERTP_RTCPImpl::GetREDStatus(int channel,
bool& enabled,
int& redPayloadtype) {
-#ifdef WEBRTC_CODEC_RED
- if (!_shared->statistics().Initialized()) {
- _shared->SetLastError(VE_NOT_INITED, kTraceError);
- return -1;
- }
- voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
- voe::Channel* channelPtr = ch.channel();
- if (channelPtr == NULL) {
- _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
- "GetREDStatus() failed to locate channel");
- return -1;
- }
- return channelPtr->GetREDStatus(enabled, redPayloadtype);
-#else
_shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
"GetREDStatus() RED is not supported");
return -1;
-#endif
}
int VoERTP_RTCPImpl::SetNACKStatus(int channel, bool enable, int maxNoPackets) {