2013-03-25 21:20:38 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2013 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef MODULES_AUDIO_PROCESSING_INCLUDE_MOCK_AUDIO_PROCESSING_H_
|
|
|
|
|
#define MODULES_AUDIO_PROCESSING_INCLUDE_MOCK_AUDIO_PROCESSING_H_
|
2013-03-25 21:20:38 +00:00
|
|
|
|
2016-02-19 07:04:49 -08:00
|
|
|
#include <memory>
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/audio_processing/include/aec_dump.h"
|
|
|
|
|
#include "modules/audio_processing/include/audio_processing.h"
|
2017-11-24 17:29:59 +01:00
|
|
|
#include "modules/audio_processing/include/audio_processing_statistics.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "test/gmock.h"
|
2013-03-25 21:20:38 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2016-10-26 05:12:24 -07:00
|
|
|
namespace test {
|
2017-12-18 16:02:40 +01:00
|
|
|
class MockCustomProcessing : public CustomProcessing {
|
2017-09-25 12:04:02 +02:00
|
|
|
public:
|
2017-12-18 16:02:40 +01:00
|
|
|
virtual ~MockCustomProcessing() {}
|
2020-05-18 15:10:15 +02:00
|
|
|
MOCK_METHOD(void,
|
|
|
|
|
Initialize,
|
|
|
|
|
(int sample_rate_hz, int num_channels),
|
|
|
|
|
(override));
|
|
|
|
|
MOCK_METHOD(void, Process, (AudioBuffer * audio), (override));
|
|
|
|
|
MOCK_METHOD(void,
|
|
|
|
|
SetRuntimeSetting,
|
|
|
|
|
(AudioProcessing::RuntimeSetting setting),
|
|
|
|
|
(override));
|
|
|
|
|
MOCK_METHOD(std::string, ToString, (), (const, override));
|
2017-09-25 12:04:02 +02:00
|
|
|
};
|
|
|
|
|
|
2018-08-29 10:37:09 +02:00
|
|
|
class MockCustomAudioAnalyzer : public CustomAudioAnalyzer {
|
|
|
|
|
public:
|
|
|
|
|
virtual ~MockCustomAudioAnalyzer() {}
|
2020-05-18 15:10:15 +02:00
|
|
|
MOCK_METHOD(void,
|
|
|
|
|
Initialize,
|
|
|
|
|
(int sample_rate_hz, int num_channels),
|
|
|
|
|
(override));
|
|
|
|
|
MOCK_METHOD(void, Analyze, (const AudioBuffer* audio), (override));
|
|
|
|
|
MOCK_METHOD(std::string, ToString, (), (const, override));
|
2018-08-29 10:37:09 +02:00
|
|
|
};
|
|
|
|
|
|
2017-10-12 15:13:17 +02:00
|
|
|
class MockEchoControl : public EchoControl {
|
|
|
|
|
public:
|
|
|
|
|
virtual ~MockEchoControl() {}
|
2020-05-18 15:10:15 +02:00
|
|
|
MOCK_METHOD(void, AnalyzeRender, (AudioBuffer * render), (override));
|
|
|
|
|
MOCK_METHOD(void, AnalyzeCapture, (AudioBuffer * capture), (override));
|
|
|
|
|
MOCK_METHOD(void,
|
|
|
|
|
ProcessCapture,
|
|
|
|
|
(AudioBuffer * capture, bool echo_path_change),
|
|
|
|
|
(override));
|
|
|
|
|
MOCK_METHOD(void,
|
|
|
|
|
ProcessCapture,
|
|
|
|
|
(AudioBuffer * capture,
|
|
|
|
|
AudioBuffer* linear_output,
|
|
|
|
|
bool echo_path_change),
|
|
|
|
|
(override));
|
|
|
|
|
MOCK_METHOD(Metrics, GetMetrics, (), (const, override));
|
|
|
|
|
MOCK_METHOD(void, SetAudioBufferDelay, (int delay_ms), (override));
|
|
|
|
|
MOCK_METHOD(bool, ActiveProcessing, (), (const, override));
|
2017-10-12 15:13:17 +02:00
|
|
|
};
|
|
|
|
|
|
2020-12-03 11:30:34 -05:00
|
|
|
class MockAudioProcessing : public AudioProcessing {
|
2013-03-25 21:20:38 +00:00
|
|
|
public:
|
2019-10-16 11:46:11 +02:00
|
|
|
MockAudioProcessing() {}
|
2013-03-25 21:20:38 +00:00
|
|
|
|
2016-10-26 05:12:24 -07:00
|
|
|
virtual ~MockAudioProcessing() {}
|
2013-03-25 21:20:38 +00:00
|
|
|
|
2020-05-18 15:10:15 +02:00
|
|
|
MOCK_METHOD(int, Initialize, (), (override));
|
|
|
|
|
MOCK_METHOD(int,
|
|
|
|
|
Initialize,
|
|
|
|
|
(int capture_input_sample_rate_hz,
|
|
|
|
|
int capture_output_sample_rate_hz,
|
|
|
|
|
int render_sample_rate_hz,
|
|
|
|
|
ChannelLayout capture_input_layout,
|
|
|
|
|
ChannelLayout capture_output_layout,
|
|
|
|
|
ChannelLayout render_input_layout),
|
|
|
|
|
(override));
|
|
|
|
|
MOCK_METHOD(int,
|
|
|
|
|
Initialize,
|
|
|
|
|
(const ProcessingConfig& processing_config),
|
|
|
|
|
(override));
|
|
|
|
|
MOCK_METHOD(void, ApplyConfig, (const Config& config), (override));
|
|
|
|
|
MOCK_METHOD(int, proc_sample_rate_hz, (), (const, override));
|
|
|
|
|
MOCK_METHOD(int, proc_split_sample_rate_hz, (), (const, override));
|
|
|
|
|
MOCK_METHOD(size_t, num_input_channels, (), (const, override));
|
|
|
|
|
MOCK_METHOD(size_t, num_proc_channels, (), (const, override));
|
|
|
|
|
MOCK_METHOD(size_t, num_output_channels, (), (const, override));
|
|
|
|
|
MOCK_METHOD(size_t, num_reverse_channels, (), (const, override));
|
|
|
|
|
MOCK_METHOD(void, set_output_will_be_muted, (bool muted), (override));
|
|
|
|
|
MOCK_METHOD(void, SetRuntimeSetting, (RuntimeSetting setting), (override));
|
|
|
|
|
MOCK_METHOD(int,
|
|
|
|
|
ProcessStream,
|
|
|
|
|
(const int16_t* const src,
|
|
|
|
|
const StreamConfig& input_config,
|
|
|
|
|
const StreamConfig& output_config,
|
|
|
|
|
int16_t* const dest),
|
|
|
|
|
(override));
|
|
|
|
|
MOCK_METHOD(int,
|
|
|
|
|
ProcessStream,
|
|
|
|
|
(const float* const* src,
|
|
|
|
|
const StreamConfig& input_config,
|
|
|
|
|
const StreamConfig& output_config,
|
|
|
|
|
float* const* dest),
|
|
|
|
|
(override));
|
|
|
|
|
MOCK_METHOD(int,
|
|
|
|
|
ProcessReverseStream,
|
|
|
|
|
(const int16_t* const src,
|
|
|
|
|
const StreamConfig& input_config,
|
|
|
|
|
const StreamConfig& output_config,
|
|
|
|
|
int16_t* const dest),
|
|
|
|
|
(override));
|
|
|
|
|
MOCK_METHOD(int,
|
|
|
|
|
AnalyzeReverseStream,
|
|
|
|
|
(const float* const* data, const StreamConfig& reverse_config),
|
|
|
|
|
(override));
|
|
|
|
|
MOCK_METHOD(int,
|
|
|
|
|
ProcessReverseStream,
|
|
|
|
|
(const float* const* src,
|
|
|
|
|
const StreamConfig& input_config,
|
|
|
|
|
const StreamConfig& output_config,
|
|
|
|
|
float* const* dest),
|
|
|
|
|
(override));
|
|
|
|
|
MOCK_METHOD(bool,
|
|
|
|
|
GetLinearAecOutput,
|
|
|
|
|
((rtc::ArrayView<std::array<float, 160>> linear_output)),
|
|
|
|
|
(const, override));
|
|
|
|
|
MOCK_METHOD(int, set_stream_delay_ms, (int delay), (override));
|
|
|
|
|
MOCK_METHOD(int, stream_delay_ms, (), (const, override));
|
|
|
|
|
MOCK_METHOD(void, set_stream_key_pressed, (bool key_pressed), (override));
|
|
|
|
|
MOCK_METHOD(void, set_stream_analog_level, (int), (override));
|
|
|
|
|
MOCK_METHOD(int, recommended_stream_analog_level, (), (const, override));
|
|
|
|
|
MOCK_METHOD(bool,
|
|
|
|
|
CreateAndAttachAecDump,
|
|
|
|
|
(const std::string& file_name,
|
|
|
|
|
int64_t max_log_size_bytes,
|
|
|
|
|
rtc::TaskQueue* worker_queue),
|
|
|
|
|
(override));
|
|
|
|
|
MOCK_METHOD(bool,
|
|
|
|
|
CreateAndAttachAecDump,
|
|
|
|
|
(FILE * handle,
|
|
|
|
|
int64_t max_log_size_bytes,
|
|
|
|
|
rtc::TaskQueue* worker_queue),
|
|
|
|
|
(override));
|
|
|
|
|
MOCK_METHOD(void, AttachAecDump, (std::unique_ptr<AecDump>), (override));
|
|
|
|
|
MOCK_METHOD(void, DetachAecDump, (), (override));
|
AudioProcessingModule has a feature to make a recording of its
configuration, inputs and outputs over a period of time. It is
activated by AudioProcessing::StartRecording. The data is stored in
binary protobuf format in a specified file. The file IO is, as of
this CL, done from the real-time audio thread.
This CL contains an interface for AecDump, a new APM submodule that
will handle the recordings. Calls to the new interface from the
AudioProcessingModule are added. These calls have no effect, and for a
short while, audio_processing_impl.cc will contain two copies of
recording calls.
The original calls are guarded by the WEBRTC_AUDIOPROC_DEBUG_DUMP
preprocessor define. They still have an effect, while the new ones do
not. In the following CLs, the old recording calls will be removed,
and an implementation of AecDump added.
The reasons for the refactoring is to move file IO operations from the
real-time audio thread, to add a top-level low-priority task queue for
logging tasks like this, to simplify and modularize audio_processing_impl.cc
and remove some of the preprocessor directives. These goals will be
archived by the upcoming CLs. The implementation is in
https://codereview.webrtc.org/2865113002.
BUG=webrtc:7404
Review-Url: https://codereview.webrtc.org/2778783002
Cr-Commit-Position: refs/heads/master@{#18233}
2017-05-23 07:20:05 -07:00
|
|
|
|
2020-05-18 15:10:15 +02:00
|
|
|
MOCK_METHOD(AudioProcessingStats, GetStatistics, (), (override));
|
|
|
|
|
MOCK_METHOD(AudioProcessingStats, GetStatistics, (bool), (override));
|
2013-03-25 21:20:38 +00:00
|
|
|
|
2020-05-18 15:10:15 +02:00
|
|
|
MOCK_METHOD(AudioProcessing::Config, GetConfig, (), (const, override));
|
2013-03-25 21:20:38 +00:00
|
|
|
};
|
|
|
|
|
|
2016-10-26 05:12:24 -07:00
|
|
|
} // namespace test
|
2013-03-25 21:20:38 +00:00
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MODULES_AUDIO_PROCESSING_INCLUDE_MOCK_AUDIO_PROCESSING_H_
|