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

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: Rebase 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..938daf62168daa105bd4b5d7d9d0a535d3b135a7 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,29 @@ 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());
+ }
+ RTC_DCHECK(built_in_agc_avaliable);
+ 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());
+ }
+ RTC_DCHECK(built_in_agc_avaliable);
+ 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 +863,16 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
new webrtc::Intelligibility(*intelligibility_enhancer_));
}
+ if (options.level_control) {
+ level_control_ = options.level_control;
+ }
+
+ LOG(LS_INFO) << "Level control: "
+ << (!!level_control_ ? *level_control_ : -1);
+ if (level_control_) {
+ config.Set<webrtc::LevelControl>(new webrtc::LevelControl(*level_control_));
+ }
+
// 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