Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: webrtc/modules/audio_coding/main/acm2/codec_manager.cc

Issue 1423803007: CodecManager: Eliminate the stereo_send_ member (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@rac2
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/codec_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/main/acm2/codec_manager.cc
diff --git a/webrtc/modules/audio_coding/main/acm2/codec_manager.cc b/webrtc/modules/audio_coding/main/acm2/codec_manager.cc
index a1a478e2139f72a7ad8a822fe4eade2c52b17a74..6a3388619249c413ed0ac2f5d91142ee7f5529a9 100644
--- a/webrtc/modules/audio_coding/main/acm2/codec_manager.cc
+++ b/webrtc/modules/audio_coding/main/acm2/codec_manager.cc
@@ -137,7 +137,6 @@ CodecManager::CodecManager()
cng_swb_pltype_(255),
cng_fb_pltype_(255),
red_nb_pltype_(255),
- stereo_send_(false),
dtx_enabled_(false),
vad_mode_(VADNormal),
send_codec_inst_(kEmptyCodecInst),
@@ -231,15 +230,12 @@ int CodecManager::RegisterEncoder(const CodecInst& send_codec) {
}
// Set Stereo, and make sure VAD and DTX is turned off.
- if (send_codec.channels == 2) {
- stereo_send_ = true;
+ if (send_codec.channels != 1) {
if (dtx_enabled_) {
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, dummy_id,
"VAD/DTX is turned off, not supported when sending stereo.");
}
dtx_enabled_ = false;
- } else {
- stereo_send_ = false;
}
// Check if the codec is already registered as send codec.
@@ -321,7 +317,7 @@ void CodecManager::RegisterEncoder(AudioEncoder* external_speech_encoder) {
static const char kName[] = "external";
memcpy(send_codec_inst_.plname, kName, sizeof(kName));
- if (stereo_send_)
+ if (send_codec_inst_.channels != 1)
dtx_enabled_ = false;
codec_fec_enabled_ =
codec_fec_enabled_ && codec_owner_.Encoder()->SetFec(codec_fec_enabled_);
@@ -374,7 +370,9 @@ int CodecManager::SetVAD(bool enable, ACMVADMode mode) {
// Check that the send codec is mono. We don't support VAD/DTX for stereo
// sending.
- if (enable && stereo_send_) {
+ const auto* enc = codec_owner_.Encoder();
+ const bool stereo_send = enc ? (enc->NumChannels() != 1) : false;
+ if (enable && stereo_send) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, 0,
"VAD/DTX not supported for stereo sending");
dtx_enabled_ = false;
@@ -391,7 +389,7 @@ int CodecManager::SetVAD(bool enable, ACMVADMode mode) {
if (dtx_enabled_ != enable || vad_mode_ != mode) {
dtx_enabled_ = enable;
vad_mode_ = mode;
- if (codec_owner_.Encoder()) {
+ if (enc) {
int cng_pt = dtx_enabled_ ? CngPayloadType(send_codec_inst_.plfreq) : -1;
int red_pt = red_enabled_ ? RedPayloadType(send_codec_inst_.plfreq) : -1;
codec_owner_.ChangeCngAndRed(cng_pt, vad_mode_, red_pt);
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/codec_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698