Move the stereo-disables-CNG logic from CodecManager to Rent-A-Codec
BUG=webrtc:5028
Review URL: https://codereview.webrtc.org/1473563004
Cr-Original-Commit-Position: refs/heads/master@{#10784}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 989b4abcf32d4a1605e7af160a1a07916c6b324e
diff --git a/modules/audio_coding/main/acm2/codec_manager.cc b/modules/audio_coding/main/acm2/codec_manager.cc
index 8022935..7db6919 100644
--- a/modules/audio_coding/main/acm2/codec_manager.cc
+++ b/modules/audio_coding/main/acm2/codec_manager.cc
@@ -149,15 +149,6 @@
break;
}
- // Set Stereo, and make sure VAD and DTX is turned off.
- if (send_codec.channels != 1) {
- if (codec_stack_params_.use_cng) {
- WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, dummy_id,
- "VAD/DTX is turned off, not supported when sending stereo.");
- }
- codec_stack_params_.use_cng = false;
- }
-
// Check if the codec is already registered as send codec.
bool new_codec = true;
if (CurrentEncoder()) {
@@ -231,8 +222,6 @@
static const char kName[] = "external";
memcpy(send_codec_inst_.plname, kName, sizeof(kName));
- if (send_codec_inst_.channels != 1)
- codec_stack_params_.use_cng = false;
if (codec_stack_params_.use_codec_fec) {
// Switch FEC on. On failure, remember that FEC is off.
if (!external_speech_encoder->SetFec(true))
diff --git a/modules/audio_coding/main/acm2/rent_a_codec.cc b/modules/audio_coding/main/acm2/rent_a_codec.cc
index 3281814..b31092c 100644
--- a/modules/audio_coding/main/acm2/rent_a_codec.cc
+++ b/modules/audio_coding/main/acm2/rent_a_codec.cc
@@ -259,7 +259,8 @@
: rtc::Optional<int>(it->second);
};
auto cng_pt = pt(param->cng_payload_types);
- param->use_cng = param->use_cng && cng_pt;
+ param->use_cng =
+ param->use_cng && cng_pt && speech_encoder->NumChannels() == 1;
auto red_pt = pt(param->red_payload_types);
param->use_red = param->use_red && red_pt;