From a8d8ad2be6b7c204bbdc8c20a942e0aefb4fa347 Mon Sep 17 00:00:00 2001 From: "buildbot@webrtc.org" Date: Wed, 16 Jul 2014 14:23:08 +0000 Subject: [PATCH] (Auto)update libjingle 71240799-> 71250251 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6705 4adac7df-926f-26a2-2b94-8c16560cd09d --- talk/media/webrtc/fakewebrtccommon.h | 5 + talk/media/webrtc/fakewebrtcvoiceengine.h | 92 +++++++++++++++++++ talk/media/webrtc/webrtcvoiceengine.cc | 7 ++ .../webrtc/webrtcvoiceengine_unittest.cc | 18 ++++ 4 files changed, 122 insertions(+) diff --git a/talk/media/webrtc/fakewebrtccommon.h b/talk/media/webrtc/fakewebrtccommon.h index 026ad10b49..dc663070ba 100644 --- a/talk/media/webrtc/fakewebrtccommon.h +++ b/talk/media/webrtc/fakewebrtccommon.h @@ -41,6 +41,11 @@ namespace cricket { #define WEBRTC_BOOL_STUB(method, args) \ virtual bool method args OVERRIDE { return true; } +#ifdef USE_WEBRTC_DEV_BRANCH +#define WEBRTC_BOOL_STUB_CONST(method, args) \ + virtual bool method args const OVERRIDE { return true; } +#endif + #define WEBRTC_VOID_STUB(method, args) \ virtual void method args OVERRIDE {} diff --git a/talk/media/webrtc/fakewebrtcvoiceengine.h b/talk/media/webrtc/fakewebrtcvoiceengine.h index a5b6031825..49b78bc5c6 100644 --- a/talk/media/webrtc/fakewebrtcvoiceengine.h +++ b/talk/media/webrtc/fakewebrtcvoiceengine.h @@ -40,6 +40,9 @@ #include "talk/media/base/voiceprocessor.h" #include "talk/media/webrtc/fakewebrtccommon.h" #include "talk/media/webrtc/webrtcvoe.h" +#ifdef USE_WEBRTC_DEV_BRANCH +#include "webrtc/modules/audio_processing/include/audio_processing.h" +#endif namespace webrtc { class ViENetwork; @@ -70,6 +73,88 @@ static const int kFakeDeviceId = 1; } \ } while (0); +#ifdef USE_WEBRTC_DEV_BRANCH +class FakeAudioProcessing : public webrtc::AudioProcessing { + public: + FakeAudioProcessing() : experimental_ns_enabled_(false) {} + + WEBRTC_STUB(Initialize, ()) + WEBRTC_STUB(Initialize, ( + int input_sample_rate_hz, + int output_sample_rate_hz, + int reverse_sample_rate_hz, + webrtc::AudioProcessing::ChannelLayout input_layout, + webrtc::AudioProcessing::ChannelLayout output_layout, + webrtc::AudioProcessing::ChannelLayout reverse_layout)); + + WEBRTC_VOID_FUNC(SetExtraOptions, (const webrtc::Config& config)) { + experimental_ns_enabled_ = config.Get().enabled; + } + + WEBRTC_STUB(set_sample_rate_hz, (int rate)); + WEBRTC_STUB_CONST(input_sample_rate_hz, ()); + WEBRTC_STUB_CONST(sample_rate_hz, ()); + WEBRTC_STUB_CONST(proc_sample_rate_hz, ()); + WEBRTC_STUB_CONST(proc_split_sample_rate_hz, ()); + WEBRTC_STUB_CONST(num_input_channels, ()); + WEBRTC_STUB_CONST(num_output_channels, ()); + WEBRTC_STUB_CONST(num_reverse_channels, ()); + WEBRTC_VOID_STUB(set_output_will_be_muted, (bool muted)); + WEBRTC_BOOL_STUB_CONST(output_will_be_muted, ()); + WEBRTC_STUB(ProcessStream, (webrtc::AudioFrame* frame)); + WEBRTC_STUB(ProcessStream, ( + const float* const* src, + int samples_per_channel, + int input_sample_rate_hz, + webrtc::AudioProcessing::ChannelLayout input_layout, + int output_sample_rate_hz, + webrtc::AudioProcessing::ChannelLayout output_layout, + float* const* dest)); + WEBRTC_STUB(AnalyzeReverseStream, (webrtc::AudioFrame* frame)); + WEBRTC_STUB(AnalyzeReverseStream, ( + const float* const* data, + int samples_per_channel, + int sample_rate_hz, + webrtc::AudioProcessing::ChannelLayout layout)); + WEBRTC_STUB(set_stream_delay_ms, (int delay)); + WEBRTC_STUB_CONST(stream_delay_ms, ()); + WEBRTC_BOOL_STUB_CONST(was_stream_delay_set, ()); + WEBRTC_VOID_STUB(set_stream_key_pressed, (bool key_pressed)); + WEBRTC_BOOL_STUB_CONST(stream_key_pressed, ()); + WEBRTC_VOID_STUB(set_delay_offset_ms, (int offset)); + WEBRTC_STUB_CONST(delay_offset_ms, ()); + WEBRTC_STUB(StartDebugRecording, (const char filename[kMaxFilenameSize])); + WEBRTC_STUB(StartDebugRecording, (FILE* handle)); + WEBRTC_STUB(StopDebugRecording, ()); + virtual webrtc::EchoCancellation* echo_cancellation() const OVERRIDE { + return NULL; + } + virtual webrtc::EchoControlMobile* echo_control_mobile() const OVERRIDE { + return NULL; + } + virtual webrtc::GainControl* gain_control() const OVERRIDE { return NULL; } + virtual webrtc::HighPassFilter* high_pass_filter() const OVERRIDE { + return NULL; + } + virtual webrtc::LevelEstimator* level_estimator() const OVERRIDE { + return NULL; + } + virtual webrtc::NoiseSuppression* noise_suppression() const OVERRIDE { + return NULL; + } + virtual webrtc::VoiceDetection* voice_detection() const OVERRIDE { + return NULL; + } + + bool experimental_ns_enabled() { + return experimental_ns_enabled_; + } + + private: + bool experimental_ns_enabled_; +}; +#endif + class FakeWebRtcVoiceEngine : public webrtc::VoEAudioProcessing, public webrtc::VoEBase, public webrtc::VoECodec, public webrtc::VoEDtmf, @@ -347,7 +432,11 @@ class FakeWebRtcVoiceEngine return 0; } virtual webrtc::AudioProcessing* audio_processing() OVERRIDE { +#ifdef USE_WEBRTC_DEV_BRANCH + return &audio_processing_; +#else return NULL; +#endif } WEBRTC_FUNC(CreateChannel, ()) { return AddChannel(); @@ -1197,6 +1286,9 @@ class FakeWebRtcVoiceEngine int playout_sample_rate_; DtmfInfo dtmf_info_; webrtc::VoEMediaProcess* media_processor_; +#ifdef USE_WEBRTC_DEV_BRANCH + FakeAudioProcessing audio_processing_; +#endif }; #undef WEBRTC_CHECK_HEADER_EXTENSION_ID diff --git a/talk/media/webrtc/webrtcvoiceengine.cc b/talk/media/webrtc/webrtcvoiceengine.cc index 1735dd8e71..d48b9bad46 100644 --- a/talk/media/webrtc/webrtcvoiceengine.cc +++ b/talk/media/webrtc/webrtcvoiceengine.cc @@ -820,6 +820,12 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) { if (options.experimental_ns.Get(&experimental_ns)) { webrtc::AudioProcessing* audioproc = voe_wrapper_->base()->audio_processing(); +#ifdef USE_WEBRTC_DEV_BRANCH + webrtc::Config config; + config.Set(new webrtc::ExperimentalNs( + experimental_ns)); + audioproc->SetExtraOptions(config); +#else // We check audioproc for the benefit of tests, since FakeWebRtcVoiceEngine // returns NULL on audio_processing(). if (audioproc) { @@ -831,6 +837,7 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) { LOG(LS_VERBOSE) << "Experimental noise suppression set to " << experimental_ns; } +#endif } bool highpass_filter; diff --git a/talk/media/webrtc/webrtcvoiceengine_unittest.cc b/talk/media/webrtc/webrtcvoiceengine_unittest.cc index 55d54ed1bf..2575b65950 100644 --- a/talk/media/webrtc/webrtcvoiceengine_unittest.cc +++ b/talk/media/webrtc/webrtcvoiceengine_unittest.cc @@ -3186,3 +3186,21 @@ TEST(WebRtcVoiceEngineTest, CoInitialize) { } #endif + +#ifdef USE_WEBRTC_DEV_BRANCH +TEST_F(WebRtcVoiceEngineTestFake, ExperimentalNsConfigViaOptions) { + EXPECT_TRUE(SetupEngine()); + + cricket::FakeAudioProcessing* audio_processing = + static_cast( + engine_.voe()->base()->audio_processing()); + + EXPECT_FALSE(audio_processing->experimental_ns_enabled()); + + cricket::AudioOptions options; + options.experimental_ns.Set(true); + EXPECT_TRUE(engine_.SetOptions(options)); + + EXPECT_TRUE(audio_processing->experimental_ns_enabled()); +} +#endif