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

Unified Diff: webrtc/media/engine/webrtcvoiceengine.cc

Issue 2095563002: Adding activation logic of the new APM level control functionality using MediaConstraints (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@ALC_RC2_CL
Patch Set: Changed to a more proper log message Created 4 years, 6 months 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/media/engine/webrtcvoiceengine.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcvoiceengine.cc
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc
index 2ddf67dd3a6d76d70236b8562cf2d5d8208bbd70..9ebd0f1888a3cbfa562de24529063698974973f6 100644
--- a/webrtc/media/engine/webrtcvoiceengine.cc
+++ b/webrtc/media/engine/webrtcvoiceengine.cc
@@ -560,6 +560,7 @@ WebRtcVoiceEngine::WebRtcVoiceEngine(
options.delay_agnostic_aec = rtc::Optional<bool>(false);
options.experimental_ns = rtc::Optional<bool>(false);
options.intelligibility_enhancer = rtc::Optional<bool>(false);
+ options.level_control = rtc::Optional<bool>(false);
bool error = ApplyOptions(options);
RTC_DCHECK(error);
}
@@ -683,9 +684,27 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
}
}
+ // Use optional to avoid uneccessary calls to BuiltInAGCIsAvailable while
+ // complying with the unittest requirements of only 1 call per test.
+ rtc::Optional<bool> built_in_agc_avaliable;
+ if (options.level_control) {
+ if (!built_in_agc_avaliable) {
+ built_in_agc_avaliable =
+ rtc::Optional<bool>(adm()->BuiltInAGCIsAvailable());
+ }
+ if (*built_in_agc_avaliable) {
+ // Disable internal software level control if built-in AGC is enabled,
+ // i.e., replace the software AGC with the built-in AGC.
+ options.level_control = rtc::Optional<bool>(false);
+ }
+ }
+
if (options.auto_gain_control) {
- const bool built_in_agc = adm()->BuiltInAGCIsAvailable();
- if (built_in_agc) {
+ if (!built_in_agc_avaliable) {
+ built_in_agc_avaliable =
+ rtc::Optional<bool>(adm()->BuiltInAGCIsAvailable());
+ }
+ if (*built_in_agc_avaliable) {
if (adm()->EnableBuiltInAGC(*options.auto_gain_control) == 0 &&
*options.auto_gain_control) {
// Disable internal software AGC if built-in AGC is enabled,
@@ -842,6 +861,18 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
new webrtc::Intelligibility(*intelligibility_enhancer_));
}
+ if (options.level_control) {
+ level_control_ = options.level_control;
+ }
+
+ if (level_control_) {
+ LOG(LS_INFO) << "Level Control is " << (*level_control_ ? "" : "not ")
+ << "enabled";
tommi 2016/06/27 08:34:33 My preference is to keep the amount of code for in
peah-webrtc 2016/06/27 08:41:12 That looks great! Done.
+ config.Set<webrtc::LevelControl>(new webrtc::LevelControl(*level_control_));
+ } else {
+ LOG(LS_INFO) << "Level Control is not enabled.";
+ }
+
// We check audioproc for the benefit of tests, since FakeWebRtcVoiceEngine
// returns NULL on audio_processing().
webrtc::AudioProcessing* audioproc = voe_wrapper_->base()->audio_processing();
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698