diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc index b33049e48..2eb97bfd8 100644 --- a/webrtc/modules/audio_processing/audio_processing_impl.cc +++ b/webrtc/modules/audio_processing/audio_processing_impl.cc @@ -186,6 +186,10 @@ void AudioProcessingImpl::SetExtraOptions(const Config& config) { (*it)->SetExtraOptions(config); } +int AudioProcessingImpl::EnableExperimentalNs(bool enable) { + return kNoError; +} + int AudioProcessingImpl::set_sample_rate_hz(int rate) { CriticalSectionScoped crit_scoped(crit_); if (rate == sample_rate_hz_) { diff --git a/webrtc/modules/audio_processing/audio_processing_impl.h b/webrtc/modules/audio_processing/audio_processing_impl.h index b0afd6d33..6c228781d 100644 --- a/webrtc/modules/audio_processing/audio_processing_impl.h +++ b/webrtc/modules/audio_processing/audio_processing_impl.h @@ -59,6 +59,10 @@ class AudioProcessingImpl : public AudioProcessing { virtual int Initialize() OVERRIDE; virtual int InitializeLocked(); virtual void SetExtraOptions(const Config& config) OVERRIDE; + virtual int EnableExperimentalNs(bool enable) OVERRIDE; + virtual bool experimental_ns_enabled() const OVERRIDE { + return false; + } virtual int set_sample_rate_hz(int rate) OVERRIDE; virtual int sample_rate_hz() const OVERRIDE; virtual int set_num_channels(int input_channels, diff --git a/webrtc/modules/audio_processing/include/audio_processing.h b/webrtc/modules/audio_processing/include/audio_processing.h index 1babe43a1..82976499d 100644 --- a/webrtc/modules/audio_processing/include/audio_processing.h +++ b/webrtc/modules/audio_processing/include/audio_processing.h @@ -155,6 +155,9 @@ class AudioProcessing : public Module { // ensures the options are applied immediately. virtual void SetExtraOptions(const Config& config) = 0; + virtual int EnableExperimentalNs(bool enable) = 0; + virtual bool experimental_ns_enabled() const = 0; + // Sets the sample |rate| in Hz for both the primary and reverse audio // streams. 8000, 16000 or 32000 Hz are permitted. virtual int set_sample_rate_hz(int rate) = 0; diff --git a/webrtc/modules/audio_processing/include/mock_audio_processing.h b/webrtc/modules/audio_processing/include/mock_audio_processing.h index 9a36fe84e..c4600bda6 100644 --- a/webrtc/modules/audio_processing/include/mock_audio_processing.h +++ b/webrtc/modules/audio_processing/include/mock_audio_processing.h @@ -183,6 +183,10 @@ class MockAudioProcessing : public AudioProcessing { int()); MOCK_METHOD1(SetExtraOptions, void(const Config& config)); + MOCK_METHOD1(EnableExperimentalNs, + int(bool enable)); + MOCK_CONST_METHOD0(experimental_ns_enabled, + bool()); MOCK_METHOD1(set_sample_rate_hz, int(int rate)); MOCK_CONST_METHOD0(sample_rate_hz, diff --git a/webrtc/voice_engine/test/cmd_test/voe_cmd_test.cc b/webrtc/voice_engine/test/cmd_test/voe_cmd_test.cc index 10fc198cd..68d096dd8 100644 --- a/webrtc/voice_engine/test/cmd_test/voe_cmd_test.cc +++ b/webrtc/voice_engine/test/cmd_test/voe_cmd_test.cc @@ -23,6 +23,7 @@ #include "webrtc/common_types.h" #include "webrtc/engine_configurations.h" #include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h" +#include "webrtc/modules/audio_processing/include/audio_processing.h" #include "webrtc/system_wrappers/interface/scoped_ptr.h" #include "webrtc/test/channel_transport/include/channel_transport.h" #include "webrtc/test/testsupport/fileutils.h" @@ -242,6 +243,7 @@ void RunTest(std::string out_path) { bool muted = false; bool on_hold = false; bool opus_stereo = false; + bool experimental_ns_enabled = false; #if defined(WEBRTC_ANDROID) std::string resource_path = "/sdcard/"; @@ -432,6 +434,7 @@ void RunTest(std::string out_path) { printf("%i. Toggle CNG\n", option_index++); printf("%i. Toggle AGC\n", option_index++); printf("%i. Toggle NS\n", option_index++); + printf("%i. Toggle experimental NS\n", option_index++); printf("%i. Toggle EC\n", option_index++); printf("%i. Select AEC\n", option_index++); printf("%i. Select AECM\n", option_index++); @@ -496,6 +499,16 @@ void RunTest(std::string out_path) { printf("\n NS is now on! \n"); else printf("\n NS is now off! \n"); + } else if (option_selection == option_index++) { + experimental_ns_enabled = !experimental_ns_enabled; + res = base1->audio_processing()->EnableExperimentalNs( + experimental_ns_enabled); + VALIDATE; + if (experimental_ns_enabled) { + printf("\n Experimental NS is now on!\n"); + } else { + printf("\n Experimental NS is now off!\n"); + } } else if (option_selection == option_index++) { enable_aec = !enable_aec; res = apm->SetEcStatus(enable_aec, kEcUnchanged);