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

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

Issue 1527933002: Add speech encoder to the encoder stack specification struct (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: don't death test on android Created 5 years 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 | « no previous file | webrtc/modules/audio_coding/acm2/rent_a_codec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/acm2/codec_manager.cc
diff --git a/webrtc/modules/audio_coding/acm2/codec_manager.cc b/webrtc/modules/audio_coding/acm2/codec_manager.cc
index 561d744f0fdb8906489a27098e81017ef128e1fa..19a79c25b1658485152987d0ce15cfc01042aa8c 100644
--- a/webrtc/modules/audio_coding/acm2/codec_manager.cc
+++ b/webrtc/modules/audio_coding/acm2/codec_manager.cc
@@ -165,7 +165,8 @@ int CodecManager::RegisterEncoder(const CodecInst& send_codec) {
AudioEncoder* enc = rent_a_codec_.RentEncoder(send_codec);
if (!enc)
return -1;
- rent_a_codec_.RentEncoderStack(enc, &codec_stack_params_);
+ codec_stack_params_.speech_encoder = enc;
+ rent_a_codec_.RentEncoderStack(&codec_stack_params_);
RTC_DCHECK(CurrentEncoder());
}
@@ -187,7 +188,8 @@ void CodecManager::RegisterEncoder(AudioEncoder* external_speech_encoder) {
static const char kName[] = "external";
memcpy(send_codec_inst_.plname, kName, sizeof(kName));
- rent_a_codec_.RentEncoderStack(external_speech_encoder, &codec_stack_params_);
+ codec_stack_params_.speech_encoder = external_speech_encoder;
+ rent_a_codec_.RentEncoderStack(&codec_stack_params_);
}
rtc::Optional<CodecInst> CodecManager::GetCodecInst() const {
@@ -219,8 +221,7 @@ bool CodecManager::SetCopyRed(bool enable) {
if (codec_stack_params_.use_red != enable) {
codec_stack_params_.use_red = enable;
if (CurrentEncoder())
- rent_a_codec_.RentEncoderStack(rent_a_codec_.GetEncoder(),
- &codec_stack_params_);
+ rent_a_codec_.RentEncoderStack(&codec_stack_params_);
}
return true;
}
@@ -232,8 +233,10 @@ int CodecManager::SetVAD(bool enable, ACMVADMode mode) {
// Check that the send codec is mono. We don't support VAD/DTX for stereo
// sending.
- auto* enc = rent_a_codec_.GetEncoder();
- const bool stereo_send = enc ? (enc->NumChannels() != 1) : false;
+ const bool stereo_send =
+ codec_stack_params_.speech_encoder
+ ? (codec_stack_params_.speech_encoder->NumChannels() != 1)
+ : false;
if (enable && stereo_send) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, 0,
"VAD/DTX not supported for stereo sending");
@@ -252,8 +255,8 @@ int CodecManager::SetVAD(bool enable, ACMVADMode mode) {
codec_stack_params_.vad_mode != mode) {
codec_stack_params_.use_cng = enable;
codec_stack_params_.vad_mode = mode;
- if (enc)
- rent_a_codec_.RentEncoderStack(enc, &codec_stack_params_);
+ if (codec_stack_params_.speech_encoder)
+ rent_a_codec_.RentEncoderStack(&codec_stack_params_);
}
return 0;
}
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/acm2/rent_a_codec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698