Index: webrtc/media/engine/webrtcvoiceengine.cc |
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc |
index 3ee5eb642c1c208c9d40b229a1b5ed26540731fb..09a072a5f3d9013b54251494d5cdb43047e8bbc8 100644 |
--- a/webrtc/media/engine/webrtcvoiceengine.cc |
+++ b/webrtc/media/engine/webrtcvoiceengine.cc |
@@ -577,6 +577,7 @@ WebRtcVoiceEngine::WebRtcVoiceEngine(webrtc::AudioDeviceModule* adm, |
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 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) { |
} |
} |
+ 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 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) { |
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(); |