Field trial support to whenever possible turn off the AGC and HPF
When operating on mobile devices, where hardware support is available for the AEC and NS functionality, it is desirable to be able to operate without hardcoded behaviors for the WebRTC AGC and HPF. This CL adds support to allow a field trial to turn these off whenever that is possible. BUG=webrtc:6220, webrtc:6183, webrtc:6181 Review-Url: https://codereview.webrtc.org/2876133002 Cr-Commit-Position: refs/heads/master@{#18226}
This commit is contained in:
@ -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.
|
||||
#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)
|
||||
// Turn off the gain control if specified by the field trial. The purpose of the field trial is to reduce the amount of resampling performed inside the audio processing module on mobile platforms by whenever possible turning off the fixed AGC mode and the high-pass filter. (https://bugs.chromium.org/p/webrtc/issues/detail?id=6181).
|
||||
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);
|
||||
|
||||
@ -27,6 +27,8 @@ NSString * const kRTCFieldTrialImprovedBitrateEstimateKey = @"WebRTC-ImprovedBit
|
||||
NSString * const kRTCFieldTrialMedianSlopeFilterKey = @"WebRTC-BweMedianSlopeFilter";
|
||||
NSString * const kRTCFieldTrialTrendlineFilterKey = @"WebRTC-BweTrendlineFilter";
|
||||
NSString * const kRTCFieldTrialH264HighProfileKey = @"WebRTC-H264HighProfile";
|
||||
NSString * const kRTCFieldTrialMinimizeResamplingOnMobileKey =
|
||||
@"WebRTC-Audio-MinimizeResamplingOnMobile";
|
||||
NSString * const kRTCFieldTrialEnabledValue = @"Enabled";
|
||||
|
||||
static std::unique_ptr<char[]> gFieldTrialInitString;
|
||||
|
||||
@ -19,6 +19,7 @@ RTC_EXTERN NSString * const kRTCFieldTrialFlexFec03AdvertisedKey;
|
||||
RTC_EXTERN NSString * const kRTCFieldTrialFlexFec03Key;
|
||||
RTC_EXTERN NSString * const kRTCFieldTrialImprovedBitrateEstimateKey;
|
||||
RTC_EXTERN NSString * const kRTCFieldTrialH264HighProfileKey;
|
||||
RTC_EXTERN NSString * const kRTCFieldTrialMinimizeResamplingOnMobileKey;
|
||||
|
||||
/** The valid value for field trials above. */
|
||||
RTC_EXTERN NSString * const kRTCFieldTrialEnabledValue;
|
||||
|
||||
Reference in New Issue
Block a user