From ab866a2ccbf595af7c8a8646a890548463ea936f Mon Sep 17 00:00:00 2001 From: Sam Zackrisson Date: Thu, 7 May 2020 13:07:49 +0200 Subject: [PATCH] Remove audio playout generator from APM API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This API is and has always been unused. Bug: webrtc:5298 Change-Id: If1201d37a00e387567d44a9ed8be99a157915b47 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174661 Reviewed-by: Per Ã…hgren Commit-Queue: Sam Zackrisson Cr-Commit-Position: refs/heads/master@{#31180} --- modules/audio_processing/BUILD.gn | 59 +------------------ .../audio_generator/file_audio_generator.cc | 36 ----------- .../audio_generator/file_audio_generator.h | 48 --------------- .../file_audio_generator_unittest.cc | 31 ---------- .../audio_processing/audio_processing_impl.cc | 11 ---- .../audio_processing/audio_processing_impl.h | 4 -- .../include/audio_generator.h | 36 ----------- .../include/audio_generator_factory.cc | 26 -------- .../include/audio_generator_factory.h | 31 ---------- .../include/audio_processing.h | 12 +--- .../include/mock_audio_processing.h | 4 -- 11 files changed, 2 insertions(+), 296 deletions(-) delete mode 100644 modules/audio_processing/audio_generator/file_audio_generator.cc delete mode 100644 modules/audio_processing/audio_generator/file_audio_generator.h delete mode 100644 modules/audio_processing/audio_generator/file_audio_generator_unittest.cc delete mode 100644 modules/audio_processing/include/audio_generator.h delete mode 100644 modules/audio_processing/include/audio_generator_factory.cc delete mode 100644 modules/audio_processing/include/audio_generator_factory.h diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn index a305189bcf..86ecbffd6c 100644 --- a/modules/audio_processing/BUILD.gn +++ b/modules/audio_processing/BUILD.gn @@ -39,9 +39,9 @@ rtc_library("api") { ] deps = [ ":audio_frame_view", - ":audio_generator_interface", ":audio_processing_statistics", ":config", + "../../api:array_view", "../../api:scoped_refptr", "../../api/audio:aec3_config", "../../api/audio:audio_frame_api", @@ -152,7 +152,6 @@ rtc_library("audio_processing") { ":audio_buffer", ":audio_frame_proxies", ":audio_frame_view", - ":audio_generator_interface", ":audio_processing_statistics", ":config", ":high_pass_filter", @@ -256,45 +255,6 @@ rtc_source_set("audio_frame_view") { deps = [ "../../api:array_view" ] } -rtc_source_set("audio_generator_interface") { - visibility = [ "*" ] - sources = [ "include/audio_generator.h" ] - deps = [ - ":audio_frame_view", - "../../rtc_base:rtc_base_approved", - "../../system_wrappers", - ] -} - -rtc_library("audio_generator_factory") { - visibility = [ "*" ] - testonly = true - sources = [ - "include/audio_generator_factory.cc", - "include/audio_generator_factory.h", - ] - deps = [ - ":audio_generator_interface", - ":file_audio_generator", - "../../common_audio", - "../../rtc_base:rtc_base_approved", - "../../system_wrappers", - ] -} - -rtc_library("file_audio_generator") { - sources = [ - "audio_generator/file_audio_generator.cc", - "audio_generator/file_audio_generator.h", - ] - deps = [ - ":audio_generator_interface", - "../../common_audio", - "../../rtc_base:rtc_base_approved", - "../../system_wrappers", - ] -} - if (rtc_enable_protobuf) { proto_library("audioproc_debug_proto") { sources = [ "debug.proto" ] @@ -372,7 +332,6 @@ if (rtc_include_tests) { ":audio_processing", ":audioproc_test_utils", ":config", - ":file_audio_generator_unittests", ":high_pass_filter", ":mocks", ":voice_detection", @@ -487,22 +446,6 @@ if (rtc_include_tests) { ] } - rtc_library("file_audio_generator_unittests") { - testonly = true - - sources = [ "audio_generator/file_audio_generator_unittest.cc" ] - - deps = [ - ":api", - ":audio_generator_factory", - ":audio_processing", - ":file_audio_generator", - "../../rtc_base:rtc_base_approved", - "../../test:fileutils", - "../../test:test_support", - ] - } - rtc_library("analog_mic_simulation") { sources = [ "test/fake_recording_device.cc", diff --git a/modules/audio_processing/audio_generator/file_audio_generator.cc b/modules/audio_processing/audio_generator/file_audio_generator.cc deleted file mode 100644 index 0d691b8bbf..0000000000 --- a/modules/audio_processing/audio_generator/file_audio_generator.cc +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "modules/audio_processing/audio_generator/file_audio_generator.h" - -namespace webrtc { - -FileAudioGenerator::FileAudioGenerator( - std::unique_ptr input_audio_file) { - // TODO(bugs.webrtc.org/8882) Stub. - // Read audio from file into internal buffer. -} - -FileAudioGenerator::~FileAudioGenerator() = default; - -void FileAudioGenerator::FillFrame(AudioFrameView audio) { - // TODO(bugs.webrtc.org/8882) Stub. - // Fill |audio| from internal buffer. -} - -size_t FileAudioGenerator::NumChannels() { - return num_channels_; -} - -size_t FileAudioGenerator::SampleRateHz() { - return sample_rate_hz_; -} - -} // namespace webrtc diff --git a/modules/audio_processing/audio_generator/file_audio_generator.h b/modules/audio_processing/audio_generator/file_audio_generator.h deleted file mode 100644 index f322b09643..0000000000 --- a/modules/audio_processing/audio_generator/file_audio_generator.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef MODULES_AUDIO_PROCESSING_AUDIO_GENERATOR_FILE_AUDIO_GENERATOR_H_ -#define MODULES_AUDIO_PROCESSING_AUDIO_GENERATOR_FILE_AUDIO_GENERATOR_H_ - -#include - -#include "common_audio/wav_file.h" -#include "modules/audio_processing/include/audio_generator.h" -#include "rtc_base/constructor_magic.h" - -namespace webrtc { - -// Provides looping audio from a file. The file is read in its entirety on -// construction and then closed. This class wraps a webrtc::WavReader, and is -// hence unsuitable for non-diagnostic code. -class FileAudioGenerator : public AudioGenerator { - public: - // Reads the playout audio from a given WAV file. - explicit FileAudioGenerator(std::unique_ptr input_audio_file); - - ~FileAudioGenerator() override; - - // Fill |audio| with audio from a file. - void FillFrame(AudioFrameView audio) override; - - size_t NumChannels() override; - - size_t SampleRateHz() override; - - private: - size_t num_channels_; - size_t sample_rate_hz_; - - RTC_DISALLOW_COPY_AND_ASSIGN(FileAudioGenerator); -}; - -} // namespace webrtc - -#endif // MODULES_AUDIO_PROCESSING_AUDIO_GENERATOR_FILE_AUDIO_GENERATOR_H_ diff --git a/modules/audio_processing/audio_generator/file_audio_generator_unittest.cc b/modules/audio_processing/audio_generator/file_audio_generator_unittest.cc deleted file mode 100644 index 6569bfe711..0000000000 --- a/modules/audio_processing/audio_generator/file_audio_generator_unittest.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include - -#include "modules/audio_processing/include/audio_generator_factory.h" -#include "modules/audio_processing/include/audio_processing.h" -#include "test/gtest.h" -#include "test/testsupport/file_utils.h" - -namespace webrtc { -namespace test { - -// TODO(bugs.webrtc.org/8882) Stub. -// Add unit tests for both file audio and generated audio. - -TEST(FileAudioGeneratorTest, CreationDeletion) { - const std::string audio_filename = - test::ResourcePath("voice_engine/audio_tiny48", "wav"); - auto audio_generator = AudioGeneratorFactory::Create(audio_filename); -} - -} // namespace test -} // namespace webrtc diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc index 6a87891164..7751bacd91 100644 --- a/modules/audio_processing/audio_processing_impl.cc +++ b/modules/audio_processing/audio_processing_impl.cc @@ -1556,17 +1556,6 @@ void AudioProcessingImpl::DetachAecDump() { } } -void AudioProcessingImpl::AttachPlayoutAudioGenerator( - std::unique_ptr audio_generator) { - // TODO(bugs.webrtc.org/8882) Stub. - // Reset internal audio generator with audio_generator. -} - -void AudioProcessingImpl::DetachPlayoutAudioGenerator() { - // TODO(bugs.webrtc.org/8882) Stub. - // Delete audio generator, if one is attached. -} - void AudioProcessingImpl::MutateConfig( rtc::FunctionView mutator) { rtc::CritScope cs_render(&crit_render_); diff --git a/modules/audio_processing/audio_processing_impl.h b/modules/audio_processing/audio_processing_impl.h index 54acee9302..188777eb51 100644 --- a/modules/audio_processing/audio_processing_impl.h +++ b/modules/audio_processing/audio_processing_impl.h @@ -72,10 +72,6 @@ class AudioProcessingImpl : public AudioProcessing { void SetExtraOptions(const webrtc::Config& config) override; void AttachAecDump(std::unique_ptr aec_dump) override; void DetachAecDump() override; - void AttachPlayoutAudioGenerator( - std::unique_ptr audio_generator) override; - void DetachPlayoutAudioGenerator() override; - void SetRuntimeSetting(RuntimeSetting setting) override; // Capture-side exclusive methods possibly running APM in a diff --git a/modules/audio_processing/include/audio_generator.h b/modules/audio_processing/include/audio_generator.h deleted file mode 100644 index 77e6284969..0000000000 --- a/modules/audio_processing/include/audio_generator.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_GENERATOR_H_ -#define MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_GENERATOR_H_ - -#include "modules/audio_processing/include/audio_frame_view.h" - -namespace webrtc { -// This class is used as input sink for the APM, for diagnostic purposes. -// Generates an infinite audio signal, [-1, 1] floating point values, in frames -// of fixed channel count and sample rate. -class AudioGenerator { - public: - virtual ~AudioGenerator() {} - - // Fill |audio| with the next samples of the audio signal. - virtual void FillFrame(AudioFrameView audio) = 0; - - // Return the number of channels output by the AudioGenerator. - virtual size_t NumChannels() = 0; - - // Return the sample rate output by the AudioGenerator. - virtual size_t SampleRateHz() = 0; -}; - -} // namespace webrtc - -#endif // MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_GENERATOR_H_ diff --git a/modules/audio_processing/include/audio_generator_factory.cc b/modules/audio_processing/include/audio_generator_factory.cc deleted file mode 100644 index d132f89607..0000000000 --- a/modules/audio_processing/include/audio_generator_factory.cc +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "modules/audio_processing/include/audio_generator_factory.h" - -#include - -#include "common_audio/wav_file.h" -#include "modules/audio_processing/audio_generator/file_audio_generator.h" - -namespace webrtc { - -std::unique_ptr AudioGeneratorFactory::Create( - const std::string& file_name) { - std::unique_ptr input_audio_file(new WavReader(file_name)); - return std::make_unique(std::move(input_audio_file)); -} - -} // namespace webrtc diff --git a/modules/audio_processing/include/audio_generator_factory.h b/modules/audio_processing/include/audio_generator_factory.h deleted file mode 100644 index a9513ef88d..0000000000 --- a/modules/audio_processing/include/audio_generator_factory.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_GENERATOR_FACTORY_H_ -#define MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_GENERATOR_FACTORY_H_ - -#include -#include -#include - -#include "modules/audio_processing/include/audio_generator.h" - -namespace webrtc { - -class AudioGeneratorFactory { - public: - // Creates an AudioGenerator that reads the playout audio from a given 16-bit - // int-encoded WAV file. - static std::unique_ptr Create(const std::string& file_name); -}; - -} // namespace webrtc - -#endif // MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_GENERATOR_FACTORY_H_ diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h index 5f90d7d5e1..25b08c61f5 100644 --- a/modules/audio_processing/include/audio_processing.h +++ b/modules/audio_processing/include/audio_processing.h @@ -24,10 +24,10 @@ #include #include "absl/types/optional.h" +#include "api/array_view.h" #include "api/audio/echo_canceller3_config.h" #include "api/audio/echo_control.h" #include "api/scoped_refptr.h" -#include "modules/audio_processing/include/audio_generator.h" #include "modules/audio_processing/include/audio_processing_statistics.h" #include "modules/audio_processing/include/config.h" #include "rtc_base/arraysize.h" @@ -614,16 +614,6 @@ class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface { // all pending logging tasks are completed. virtual void DetachAecDump() = 0; - // Attaches provided webrtc::AudioGenerator for modifying playout audio. - // Calling this method when another AudioGenerator is attached replaces the - // active AudioGenerator with a new one. - virtual void AttachPlayoutAudioGenerator( - std::unique_ptr audio_generator) = 0; - - // If no AudioGenerator is attached, this has no effect. If an AecDump is - // attached, its destructor is called. - virtual void DetachPlayoutAudioGenerator() = 0; - // Get audio processing statistics. virtual AudioProcessingStats GetStatistics() = 0; // TODO(webrtc:5298) Deprecated variant. The |has_remote_tracks| argument diff --git a/modules/audio_processing/include/mock_audio_processing.h b/modules/audio_processing/include/mock_audio_processing.h index 2346489b2a..9492a38cd2 100644 --- a/modules/audio_processing/include/mock_audio_processing.h +++ b/modules/audio_processing/include/mock_audio_processing.h @@ -132,10 +132,6 @@ class MockAudioProcessing : public ::testing::NiceMock { virtual void AttachAecDump(std::unique_ptr aec_dump) {} MOCK_METHOD0(DetachAecDump, void()); - virtual void AttachPlayoutAudioGenerator( - std::unique_ptr audio_generator) {} - MOCK_METHOD0(DetachPlayoutAudioGenerator, void()); - MOCK_METHOD0(GetStatistics, AudioProcessingStats()); MOCK_METHOD1(GetStatistics, AudioProcessingStats(bool));