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

Side by Side Diff: webrtc/media/engine/webrtcvoiceengine.cc

Issue 1952123003: Surface the IntelligibilityEnhancer on MediaConstraints (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix NS enabling logic Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 options.highpass_filter = rtc::Optional<bool>(true); 570 options.highpass_filter = rtc::Optional<bool>(true);
571 options.stereo_swapping = rtc::Optional<bool>(false); 571 options.stereo_swapping = rtc::Optional<bool>(false);
572 options.audio_jitter_buffer_max_packets = rtc::Optional<int>(50); 572 options.audio_jitter_buffer_max_packets = rtc::Optional<int>(50);
573 options.audio_jitter_buffer_fast_accelerate = rtc::Optional<bool>(false); 573 options.audio_jitter_buffer_fast_accelerate = rtc::Optional<bool>(false);
574 options.typing_detection = rtc::Optional<bool>(true); 574 options.typing_detection = rtc::Optional<bool>(true);
575 options.adjust_agc_delta = rtc::Optional<int>(0); 575 options.adjust_agc_delta = rtc::Optional<int>(0);
576 options.experimental_agc = rtc::Optional<bool>(false); 576 options.experimental_agc = rtc::Optional<bool>(false);
577 options.extended_filter_aec = rtc::Optional<bool>(false); 577 options.extended_filter_aec = rtc::Optional<bool>(false);
578 options.delay_agnostic_aec = rtc::Optional<bool>(false); 578 options.delay_agnostic_aec = rtc::Optional<bool>(false);
579 options.experimental_ns = rtc::Optional<bool>(false); 579 options.experimental_ns = rtc::Optional<bool>(false);
580 options.intelligibility_enhancer = rtc::Optional<bool>(false);
580 bool error = ApplyOptions(options); 581 bool error = ApplyOptions(options);
581 RTC_DCHECK(error); 582 RTC_DCHECK(error);
582 } 583 }
583 584
584 SetDefaultDevices(); 585 SetDefaultDevices();
585 } 586 }
586 587
587 WebRtcVoiceEngine::~WebRtcVoiceEngine() { 588 WebRtcVoiceEngine::~WebRtcVoiceEngine() {
588 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 589 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
589 LOG(LS_INFO) << "WebRtcVoiceEngine::~WebRtcVoiceEngine"; 590 LOG(LS_INFO) << "WebRtcVoiceEngine::~WebRtcVoiceEngine";
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 options.tx_agc_limiter.value_or(default_agc_config_.limiterEnable); 740 options.tx_agc_limiter.value_or(default_agc_config_.limiterEnable);
740 if (voe_wrapper_->processing()->SetAgcConfig(default_agc_config_) == -1) { 741 if (voe_wrapper_->processing()->SetAgcConfig(default_agc_config_) == -1) {
741 LOG_RTCERR3(SetAgcConfig, 742 LOG_RTCERR3(SetAgcConfig,
742 default_agc_config_.targetLeveldBOv, 743 default_agc_config_.targetLeveldBOv,
743 default_agc_config_.digitalCompressionGaindB, 744 default_agc_config_.digitalCompressionGaindB,
744 default_agc_config_.limiterEnable); 745 default_agc_config_.limiterEnable);
745 return false; 746 return false;
746 } 747 }
747 } 748 }
748 749
750 if (options.intelligibility_enhancer) {
751 intelligibility_enhancer_ = options.intelligibility_enhancer;
752 }
753 if (intelligibility_enhancer_ && *intelligibility_enhancer_) {
754 LOG(LS_INFO) << "Enabling NS when Intelligibility Enhancer is active.";
755 options.noise_suppression = intelligibility_enhancer_;
756 }
757
749 if (options.noise_suppression) { 758 if (options.noise_suppression) {
750 const bool built_in_ns = adm()->BuiltInNSIsAvailable(); 759 if (adm()->BuiltInNSIsAvailable()) {
peah-webrtc 2016/05/13 12:39:49 I'm concerned about the AEC functionality as the I
aluebs-webrtc 2016/05/13 16:24:28 This CL doesn't enable IE, it just surfaces it to
peah-webrtc 2016/05/16 07:43:38 Thanks for the clarification! I definitely agree o
aluebs-webrtc 2016/05/16 20:21:16 I completely agree we should do a proper analysis
751 if (built_in_ns) { 760 bool builtin_ns =
752 if (adm()->EnableBuiltInNS(*options.noise_suppression) == 0 && 761 *options.noise_suppression &&
753 *options.noise_suppression) { 762 !(intelligibility_enhancer_ && *intelligibility_enhancer_);
763 if (adm()->EnableBuiltInNS(builtin_ns) == 0 && builtin_ns) {
754 // Disable internal software NS if built-in NS is enabled, 764 // Disable internal software NS if built-in NS is enabled,
755 // i.e., replace the software NS with the built-in NS. 765 // i.e., replace the software NS with the built-in NS.
756 options.noise_suppression = rtc::Optional<bool>(false); 766 options.noise_suppression = rtc::Optional<bool>(false);
757 LOG(LS_INFO) << "Disabling NS since built-in NS will be used instead"; 767 LOG(LS_INFO) << "Disabling NS since built-in NS will be used instead";
758 } 768 }
759 } 769 }
760 if (voep->SetNsStatus(*options.noise_suppression, ns_mode) == -1) { 770 if (voep->SetNsStatus(*options.noise_suppression, ns_mode) == -1) {
761 LOG_RTCERR2(SetNsStatus, *options.noise_suppression, ns_mode); 771 LOG_RTCERR2(SetNsStatus, *options.noise_suppression, ns_mode);
762 return false; 772 return false;
763 } else { 773 } else {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 846
837 if (options.experimental_ns) { 847 if (options.experimental_ns) {
838 experimental_ns_ = options.experimental_ns; 848 experimental_ns_ = options.experimental_ns;
839 } 849 }
840 if (experimental_ns_) { 850 if (experimental_ns_) {
841 LOG(LS_INFO) << "Experimental ns is enabled? " << *experimental_ns_; 851 LOG(LS_INFO) << "Experimental ns is enabled? " << *experimental_ns_;
842 config.Set<webrtc::ExperimentalNs>( 852 config.Set<webrtc::ExperimentalNs>(
843 new webrtc::ExperimentalNs(*experimental_ns_)); 853 new webrtc::ExperimentalNs(*experimental_ns_));
844 } 854 }
845 855
856 if (intelligibility_enhancer_) {
857 LOG(LS_INFO) << "Intelligibility Enhancer is enabled? "
858 << *intelligibility_enhancer_;
859 config.Set<webrtc::Intelligibility>(
860 new webrtc::Intelligibility(*intelligibility_enhancer_));
861 }
862
846 // We check audioproc for the benefit of tests, since FakeWebRtcVoiceEngine 863 // We check audioproc for the benefit of tests, since FakeWebRtcVoiceEngine
847 // returns NULL on audio_processing(). 864 // returns NULL on audio_processing().
848 webrtc::AudioProcessing* audioproc = voe_wrapper_->base()->audio_processing(); 865 webrtc::AudioProcessing* audioproc = voe_wrapper_->base()->audio_processing();
849 if (audioproc) { 866 if (audioproc) {
850 audioproc->SetExtraOptions(config); 867 audioproc->SetExtraOptions(config);
851 } 868 }
852 869
853 if (options.recording_sample_rate) { 870 if (options.recording_sample_rate) {
854 LOG(LS_INFO) << "Recording sample rate is " 871 LOG(LS_INFO) << "Recording sample rate is "
855 << *options.recording_sample_rate; 872 << *options.recording_sample_rate;
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
2556 } 2573 }
2557 } else { 2574 } else {
2558 LOG(LS_INFO) << "Stopping playout for channel #" << channel; 2575 LOG(LS_INFO) << "Stopping playout for channel #" << channel;
2559 engine()->voe()->base()->StopPlayout(channel); 2576 engine()->voe()->base()->StopPlayout(channel);
2560 } 2577 }
2561 return true; 2578 return true;
2562 } 2579 }
2563 } // namespace cricket 2580 } // namespace cricket
2564 2581
2565 #endif // HAVE_WEBRTC_VOICE 2582 #endif // HAVE_WEBRTC_VOICE
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698