Files
platform-external-webrtc/modules/audio_processing/include/mock_audio_processing.h
Per Åhgren 09e9a83d91 Change the way that AecDumps are created in APM
This CL changes the way that AecDumps are created in APM. Instead
of being injected, they are now created via the API.

This removes the AecDumpFactory from the API surface of APM and
makes the API more explicit.

The CL will be followed by one more CL that deprecates the usage
of the AttachAecDump API also within the audio_processing
and the fuzzer folders.

The CL also moves the aec_dump.* files from the include folder
to the aec_dump folder and changes the build files. The reasons
for this are that
1) The content of aec_dump.h is not really part of the API
   surface of APM.
2) Those files anyway needed to be moved to a separate build-
   target to avoid a circular build-file dependency caused by
   the other changes in this CL

Bug: webrtc:5298
Change-Id: I7dd6b49de76eb44158472874e1d4ae17dca9be54
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174750
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31207}
2020-05-11 10:33:00 +00:00

151 lines
6.0 KiB
C++

/*
* 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.
*/
#ifndef MODULES_AUDIO_PROCESSING_INCLUDE_MOCK_AUDIO_PROCESSING_H_
#define MODULES_AUDIO_PROCESSING_INCLUDE_MOCK_AUDIO_PROCESSING_H_
#include <memory>
#include "modules/audio_processing/include/aec_dump.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "modules/audio_processing/include/audio_processing_statistics.h"
#include "test/gmock.h"
namespace webrtc {
namespace test {
class MockCustomProcessing : public CustomProcessing {
public:
virtual ~MockCustomProcessing() {}
MOCK_METHOD2(Initialize, void(int sample_rate_hz, int num_channels));
MOCK_METHOD1(Process, void(AudioBuffer* audio));
MOCK_METHOD1(SetRuntimeSetting,
void(AudioProcessing::RuntimeSetting setting));
MOCK_CONST_METHOD0(ToString, std::string());
};
class MockCustomAudioAnalyzer : public CustomAudioAnalyzer {
public:
virtual ~MockCustomAudioAnalyzer() {}
MOCK_METHOD2(Initialize, void(int sample_rate_hz, int num_channels));
MOCK_METHOD1(Analyze, void(const AudioBuffer* audio));
MOCK_CONST_METHOD0(ToString, std::string());
};
class MockEchoControl : public EchoControl {
public:
virtual ~MockEchoControl() {}
MOCK_METHOD1(AnalyzeRender, void(AudioBuffer* render));
MOCK_METHOD1(AnalyzeCapture, void(AudioBuffer* capture));
MOCK_METHOD2(ProcessCapture,
void(AudioBuffer* capture, bool echo_path_change));
MOCK_METHOD3(ProcessCapture,
void(AudioBuffer* capture,
AudioBuffer* linear_output,
bool echo_path_change));
MOCK_CONST_METHOD0(GetMetrics, Metrics());
MOCK_METHOD1(SetAudioBufferDelay, void(int delay_ms));
MOCK_CONST_METHOD0(ActiveProcessing, bool());
};
class MockAudioProcessing : public ::testing::NiceMock<AudioProcessing> {
public:
MockAudioProcessing() {}
virtual ~MockAudioProcessing() {}
MOCK_METHOD0(Initialize, int());
MOCK_METHOD6(Initialize,
int(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));
MOCK_METHOD1(Initialize, int(const ProcessingConfig& processing_config));
MOCK_METHOD1(ApplyConfig, void(const Config& config));
MOCK_METHOD1(SetExtraOptions, void(const webrtc::Config& config));
MOCK_CONST_METHOD0(proc_sample_rate_hz, int());
MOCK_CONST_METHOD0(proc_split_sample_rate_hz, int());
MOCK_CONST_METHOD0(num_input_channels, size_t());
MOCK_CONST_METHOD0(num_proc_channels, size_t());
MOCK_CONST_METHOD0(num_output_channels, size_t());
MOCK_CONST_METHOD0(num_reverse_channels, size_t());
MOCK_METHOD1(set_output_will_be_muted, void(bool muted));
MOCK_METHOD1(SetRuntimeSetting, void(RuntimeSetting setting));
MOCK_METHOD4(ProcessStream,
int(const int16_t* const src,
const StreamConfig& input_config,
const StreamConfig& output_config,
int16_t* const dest));
MOCK_METHOD7(ProcessStream,
int(const float* const* src,
size_t samples_per_channel,
int input_sample_rate_hz,
ChannelLayout input_layout,
int output_sample_rate_hz,
ChannelLayout output_layout,
float* const* dest));
MOCK_METHOD4(ProcessStream,
int(const float* const* src,
const StreamConfig& input_config,
const StreamConfig& output_config,
float* const* dest));
MOCK_METHOD4(ProcessReverseStream,
int(const int16_t* const src,
const StreamConfig& input_config,
const StreamConfig& output_config,
int16_t* const dest));
MOCK_METHOD4(AnalyzeReverseStream,
int(const float* const* data,
size_t samples_per_channel,
int sample_rate_hz,
ChannelLayout layout));
MOCK_METHOD2(AnalyzeReverseStream,
int(const float* const* data,
const StreamConfig& reverse_config));
MOCK_METHOD4(ProcessReverseStream,
int(const float* const* src,
const StreamConfig& input_config,
const StreamConfig& output_config,
float* const* dest));
MOCK_CONST_METHOD1(
GetLinearAecOutput,
bool(rtc::ArrayView<std::array<float, 160>> linear_output));
MOCK_METHOD1(set_stream_delay_ms, int(int delay));
MOCK_CONST_METHOD0(stream_delay_ms, int());
MOCK_CONST_METHOD0(was_stream_delay_set, bool());
MOCK_METHOD1(set_stream_key_pressed, void(bool key_pressed));
MOCK_METHOD1(set_delay_offset_ms, void(int offset));
MOCK_CONST_METHOD0(delay_offset_ms, int());
MOCK_METHOD1(set_stream_analog_level, void(int));
MOCK_CONST_METHOD0(recommended_stream_analog_level, int());
MOCK_METHOD3(CreateAndAttachAecDump,
bool(const std::string& file_name,
int64_t max_log_size_bytes,
rtc::TaskQueue* worker_queue));
MOCK_METHOD3(CreateAndAttachAecDump,
bool(FILE* handle,
int64_t max_log_size_bytes,
rtc::TaskQueue* worker_queue));
MOCK_METHOD1(AttachAecDump, void(std::unique_ptr<AecDump>));
MOCK_METHOD0(DetachAecDump, void());
MOCK_METHOD0(GetStatistics, AudioProcessingStats());
MOCK_METHOD1(GetStatistics, AudioProcessingStats(bool));
MOCK_CONST_METHOD0(GetConfig, AudioProcessing::Config());
};
} // namespace test
} // namespace webrtc
#endif // MODULES_AUDIO_PROCESSING_INCLUDE_MOCK_AUDIO_PROCESSING_H_