Remove audio playout generator from APM API

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 <peah@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31180}
This commit is contained in:
Sam Zackrisson
2020-05-07 13:07:49 +02:00
committed by Commit Bot
parent b63331bb8f
commit ab866a2ccb
11 changed files with 2 additions and 296 deletions

View File

@ -39,9 +39,9 @@ rtc_library("api") {
] ]
deps = [ deps = [
":audio_frame_view", ":audio_frame_view",
":audio_generator_interface",
":audio_processing_statistics", ":audio_processing_statistics",
":config", ":config",
"../../api:array_view",
"../../api:scoped_refptr", "../../api:scoped_refptr",
"../../api/audio:aec3_config", "../../api/audio:aec3_config",
"../../api/audio:audio_frame_api", "../../api/audio:audio_frame_api",
@ -152,7 +152,6 @@ rtc_library("audio_processing") {
":audio_buffer", ":audio_buffer",
":audio_frame_proxies", ":audio_frame_proxies",
":audio_frame_view", ":audio_frame_view",
":audio_generator_interface",
":audio_processing_statistics", ":audio_processing_statistics",
":config", ":config",
":high_pass_filter", ":high_pass_filter",
@ -256,45 +255,6 @@ rtc_source_set("audio_frame_view") {
deps = [ "../../api:array_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) { if (rtc_enable_protobuf) {
proto_library("audioproc_debug_proto") { proto_library("audioproc_debug_proto") {
sources = [ "debug.proto" ] sources = [ "debug.proto" ]
@ -372,7 +332,6 @@ if (rtc_include_tests) {
":audio_processing", ":audio_processing",
":audioproc_test_utils", ":audioproc_test_utils",
":config", ":config",
":file_audio_generator_unittests",
":high_pass_filter", ":high_pass_filter",
":mocks", ":mocks",
":voice_detection", ":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") { rtc_library("analog_mic_simulation") {
sources = [ sources = [
"test/fake_recording_device.cc", "test/fake_recording_device.cc",

View File

@ -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<WavReader> input_audio_file) {
// TODO(bugs.webrtc.org/8882) Stub.
// Read audio from file into internal buffer.
}
FileAudioGenerator::~FileAudioGenerator() = default;
void FileAudioGenerator::FillFrame(AudioFrameView<float> 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

View File

@ -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 <memory>
#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<WavReader> input_audio_file);
~FileAudioGenerator() override;
// Fill |audio| with audio from a file.
void FillFrame(AudioFrameView<float> 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_

View File

@ -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 <string>
#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

View File

@ -1556,17 +1556,6 @@ void AudioProcessingImpl::DetachAecDump() {
} }
} }
void AudioProcessingImpl::AttachPlayoutAudioGenerator(
std::unique_ptr<AudioGenerator> 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( void AudioProcessingImpl::MutateConfig(
rtc::FunctionView<void(AudioProcessing::Config*)> mutator) { rtc::FunctionView<void(AudioProcessing::Config*)> mutator) {
rtc::CritScope cs_render(&crit_render_); rtc::CritScope cs_render(&crit_render_);

View File

@ -72,10 +72,6 @@ class AudioProcessingImpl : public AudioProcessing {
void SetExtraOptions(const webrtc::Config& config) override; void SetExtraOptions(const webrtc::Config& config) override;
void AttachAecDump(std::unique_ptr<AecDump> aec_dump) override; void AttachAecDump(std::unique_ptr<AecDump> aec_dump) override;
void DetachAecDump() override; void DetachAecDump() override;
void AttachPlayoutAudioGenerator(
std::unique_ptr<AudioGenerator> audio_generator) override;
void DetachPlayoutAudioGenerator() override;
void SetRuntimeSetting(RuntimeSetting setting) override; void SetRuntimeSetting(RuntimeSetting setting) override;
// Capture-side exclusive methods possibly running APM in a // Capture-side exclusive methods possibly running APM in a

View File

@ -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<float> 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_

View File

@ -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 <memory>
#include "common_audio/wav_file.h"
#include "modules/audio_processing/audio_generator/file_audio_generator.h"
namespace webrtc {
std::unique_ptr<AudioGenerator> AudioGeneratorFactory::Create(
const std::string& file_name) {
std::unique_ptr<WavReader> input_audio_file(new WavReader(file_name));
return std::make_unique<FileAudioGenerator>(std::move(input_audio_file));
}
} // namespace webrtc

View File

@ -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 <memory>
#include <string>
#include <utility>
#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<AudioGenerator> Create(const std::string& file_name);
};
} // namespace webrtc
#endif // MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_GENERATOR_FACTORY_H_

View File

@ -24,10 +24,10 @@
#include <vector> #include <vector>
#include "absl/types/optional.h" #include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/audio/echo_canceller3_config.h" #include "api/audio/echo_canceller3_config.h"
#include "api/audio/echo_control.h" #include "api/audio/echo_control.h"
#include "api/scoped_refptr.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/audio_processing_statistics.h"
#include "modules/audio_processing/include/config.h" #include "modules/audio_processing/include/config.h"
#include "rtc_base/arraysize.h" #include "rtc_base/arraysize.h"
@ -614,16 +614,6 @@ class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface {
// all pending logging tasks are completed. // all pending logging tasks are completed.
virtual void DetachAecDump() = 0; 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<AudioGenerator> 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. // Get audio processing statistics.
virtual AudioProcessingStats GetStatistics() = 0; virtual AudioProcessingStats GetStatistics() = 0;
// TODO(webrtc:5298) Deprecated variant. The |has_remote_tracks| argument // TODO(webrtc:5298) Deprecated variant. The |has_remote_tracks| argument

View File

@ -132,10 +132,6 @@ class MockAudioProcessing : public ::testing::NiceMock<AudioProcessing> {
virtual void AttachAecDump(std::unique_ptr<AecDump> aec_dump) {} virtual void AttachAecDump(std::unique_ptr<AecDump> aec_dump) {}
MOCK_METHOD0(DetachAecDump, void()); MOCK_METHOD0(DetachAecDump, void());
virtual void AttachPlayoutAudioGenerator(
std::unique_ptr<AudioGenerator> audio_generator) {}
MOCK_METHOD0(DetachPlayoutAudioGenerator, void());
MOCK_METHOD0(GetStatistics, AudioProcessingStats()); MOCK_METHOD0(GetStatistics, AudioProcessingStats());
MOCK_METHOD1(GetStatistics, AudioProcessingStats(bool)); MOCK_METHOD1(GetStatistics, AudioProcessingStats(bool));