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

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

Issue 2876133002: Field trial support to whenever possible turn off the AGC and HPF (Closed)
Patch Set: Added Obj-C field trial support Created 3 years, 7 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
Index: webrtc/media/engine/webrtcvoiceengine.cc
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc
index 2b0f72aef1ff5ee8786f5a73e0a0e58d4f29147b..e4105a7e91479eb56493db7c488c35f683dceea8 100644
--- a/webrtc/media/engine/webrtcvoiceengine.cc
+++ b/webrtc/media/engine/webrtcvoiceengine.cc
@@ -336,6 +336,7 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
LOG(LS_INFO) << "WebRtcVoiceEngine::ApplyOptions: " << options_in.ToString();
AudioOptions options = options_in; // The options are modified below.
+ // Set and adjust echo canceller options.
// kEcConference is AEC with high suppression.
webrtc::EcModes ec_mode = webrtc::kEcConference;
if (options.aecm_generate_comfort_noise) {
@@ -345,21 +346,13 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
}
#if defined(WEBRTC_IOS)
- // On iOS, VPIO provides built-in EC, NS and AGC.
+ // On iOS, VPIO provides built-in EC.
options.echo_cancellation = rtc::Optional<bool>(false);
- options.auto_gain_control = rtc::Optional<bool>(false);
- options.noise_suppression = rtc::Optional<bool>(false);
- LOG(LS_INFO)
- << "Always disable AEC, NS and AGC on iOS. Use built-in instead.";
+ options.extended_filter_aec = rtc::Optional<bool>(false);
+ LOG(LS_INFO) << "Always disable AEC on iOS. Use built-in instead.";
#elif defined(ANDROID)
ec_mode = webrtc::kEcAecm;
-#endif
-
-#if defined(WEBRTC_IOS) || defined(ANDROID)
- options.typing_detection = rtc::Optional<bool>(false);
- options.experimental_agc = rtc::Optional<bool>(false);
options.extended_filter_aec = rtc::Optional<bool>(false);
- options.experimental_ns = rtc::Optional<bool>(false);
#endif
// Delay Agnostic AEC automatically turns on EC if not set except on iOS
@@ -376,6 +369,43 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
}
#endif
+// Set and adjust noise suppressor options.
henrika_webrtc 2017/05/12 09:27:31 It is not clear to me what you change here. Is it
peah-webrtc 2017/05/12 09:54:07 The actual changes related to the field trial are
henrika_webrtc 2017/05/17 07:32:59 The new code looks less bad ;-)
peah-webrtc 2017/05/22 21:47:19 :-) That is a step in the right direction.
+#if defined(WEBRTC_IOS)
+ // On iOS, VPIO provides built-in NS.
+ options.noise_suppression = rtc::Optional<bool>(false);
+ options.typing_detection = rtc::Optional<bool>(false);
+ options.experimental_ns = rtc::Optional<bool>(false);
+ LOG(LS_INFO) << "Always disable NS on iOS. Use built-in instead.";
+#elif defined(ANDROID)
+ options.typing_detection = rtc::Optional<bool>(false);
+ options.experimental_ns = rtc::Optional<bool>(false);
+#endif
+
+// Set and adjust gain control options.
+#if defined(WEBRTC_IOS)
+ // On iOS, VPIO provides built-in AGC.
+ options.auto_gain_control = rtc::Optional<bool>(false);
+ options.experimental_agc = rtc::Optional<bool>(false);
+ LOG(LS_INFO) << "Always disable AGC on iOS. Use built-in instead.";
+#elif defined(ANDROID)
+ options.experimental_agc = rtc::Optional<bool>(false);
+#endif
+
+#if defined(WEBRTC_IOS) || defined(WEBRTC_ANDROID)
henrika_webrtc 2017/05/12 12:20:47 Please add some comments here about what you inten
peah-webrtc 2017/05/22 21:47:19 Done.
+ // Turn off the gain control if specified by the field trial.
+ if (webrtc::field_trial::IsEnabled(
+ "WebRTC-Audio-MinimizeResamplingOnMobile")) {
+ options.auto_gain_control = rtc::Optional<bool>(false);
+ LOG(LS_INFO) << "Disable AGC according to field trial.";
+ if (!(options.noise_suppression.value_or(false) or
+ options.echo_cancellation.value_or(false))) {
+ // If possible, turn off the high-pass filter.
+ LOG(LS_INFO) << "Disable high-pass filter in response to field trial.";
+ options.highpass_filter = rtc::Optional<bool>(false);
+ }
+ }
+#endif
+
#if (WEBRTC_INTELLIGIBILITY_ENHANCER == 0)
// Hardcode the intelligibility enhancer to be off.
options.intelligibility_enhancer = rtc::Optional<bool>(false);

Powered by Google App Engine
This is Rietveld 408576698