Surface the IntelligibilityEnhancer on MediaConstraints
R=henrika@webrtc.org, peah@webrtc.org, tommi@webrtc.org
Review URL: https://codereview.webrtc.org/1952123003 .
Cr-Commit-Position: refs/heads/master@{#12763}
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc
index 3ee5eb6..09a072a 100644
--- a/webrtc/media/engine/webrtcvoiceengine.cc
+++ b/webrtc/media/engine/webrtcvoiceengine.cc
@@ -577,6 +577,7 @@
options.extended_filter_aec = rtc::Optional<bool>(false);
options.delay_agnostic_aec = rtc::Optional<bool>(false);
options.experimental_ns = rtc::Optional<bool>(false);
+ options.intelligibility_enhancer = rtc::Optional<bool>(false);
bool error = ApplyOptions(options);
RTC_DCHECK(error);
}
@@ -746,11 +747,20 @@
}
}
+ if (options.intelligibility_enhancer) {
+ intelligibility_enhancer_ = options.intelligibility_enhancer;
+ }
+ if (intelligibility_enhancer_ && *intelligibility_enhancer_) {
+ LOG(LS_INFO) << "Enabling NS when Intelligibility Enhancer is active.";
+ options.noise_suppression = intelligibility_enhancer_;
+ }
+
if (options.noise_suppression) {
- const bool built_in_ns = adm()->BuiltInNSIsAvailable();
- if (built_in_ns) {
- if (adm()->EnableBuiltInNS(*options.noise_suppression) == 0 &&
- *options.noise_suppression) {
+ if (adm()->BuiltInNSIsAvailable()) {
+ bool builtin_ns =
+ *options.noise_suppression &&
+ !(intelligibility_enhancer_ && *intelligibility_enhancer_);
+ if (adm()->EnableBuiltInNS(builtin_ns) == 0 && builtin_ns) {
// Disable internal software NS if built-in NS is enabled,
// i.e., replace the software NS with the built-in NS.
options.noise_suppression = rtc::Optional<bool>(false);
@@ -843,6 +853,13 @@
new webrtc::ExperimentalNs(*experimental_ns_));
}
+ if (intelligibility_enhancer_) {
+ LOG(LS_INFO) << "Intelligibility Enhancer is enabled? "
+ << *intelligibility_enhancer_;
+ config.Set<webrtc::Intelligibility>(
+ new webrtc::Intelligibility(*intelligibility_enhancer_));
+ }
+
// We check audioproc for the benefit of tests, since FakeWebRtcVoiceEngine
// returns NULL on audio_processing().
webrtc::AudioProcessing* audioproc = voe_wrapper_->base()->audio_processing();