- Replace FakeAudioProcessing in WVoE unittest with MockAudioProcessing.
- Update MockAudioProcessing to current APM interface. - Replace calls to VoEAudioProcessing::Start/StopAecDump with direct calls on APM. - Add AudioProcessing* in WVoE, get it from VoE, so we can call directly on APM. BUG=webrtc:4690 Review-Url: https://codereview.webrtc.org/2446143002 Cr-Commit-Position: refs/heads/master@{#14786}
This commit is contained in:
@ -45,99 +45,11 @@ static const int kOpusBandwidthFb = 20000;
|
|||||||
#define WEBRTC_BOOL_STUB(method, args) \
|
#define WEBRTC_BOOL_STUB(method, args) \
|
||||||
bool method args override { return true; }
|
bool method args override { return true; }
|
||||||
|
|
||||||
#define WEBRTC_BOOL_STUB_CONST(method, args) \
|
|
||||||
bool method args const override { return true; }
|
|
||||||
|
|
||||||
#define WEBRTC_VOID_STUB(method, args) \
|
#define WEBRTC_VOID_STUB(method, args) \
|
||||||
void method args override {}
|
void method args override {}
|
||||||
|
|
||||||
#define WEBRTC_FUNC(method, args) int method args override
|
#define WEBRTC_FUNC(method, args) int method args override
|
||||||
|
|
||||||
#define WEBRTC_VOID_FUNC(method, args) void method args override
|
|
||||||
|
|
||||||
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_STUB(Initialize, (
|
|
||||||
const webrtc::ProcessingConfig& processing_config));
|
|
||||||
|
|
||||||
WEBRTC_VOID_STUB(ApplyConfig, (const AudioProcessing::Config& config));
|
|
||||||
WEBRTC_VOID_FUNC(SetExtraOptions, (const webrtc::Config& config)) {
|
|
||||||
experimental_ns_enabled_ = config.Get<webrtc::ExperimentalNs>().enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
WEBRTC_STUB_CONST(proc_sample_rate_hz, ());
|
|
||||||
WEBRTC_STUB_CONST(proc_split_sample_rate_hz, ());
|
|
||||||
size_t num_input_channels() const override { return 0; }
|
|
||||||
size_t num_proc_channels() const override { return 0; }
|
|
||||||
size_t num_output_channels() const override { return 0; }
|
|
||||||
size_t num_reverse_channels() const override { return 0; }
|
|
||||||
WEBRTC_VOID_STUB(set_output_will_be_muted, (bool muted));
|
|
||||||
WEBRTC_STUB(ProcessStream, (webrtc::AudioFrame* frame));
|
|
||||||
WEBRTC_STUB(ProcessStream, (
|
|
||||||
const float* const* src,
|
|
||||||
size_t 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(ProcessStream,
|
|
||||||
(const float* const* src,
|
|
||||||
const webrtc::StreamConfig& input_config,
|
|
||||||
const webrtc::StreamConfig& output_config,
|
|
||||||
float* const* dest));
|
|
||||||
WEBRTC_STUB(ProcessReverseStream, (webrtc::AudioFrame * frame));
|
|
||||||
WEBRTC_STUB(AnalyzeReverseStream, (
|
|
||||||
const float* const* data,
|
|
||||||
size_t samples_per_channel,
|
|
||||||
int sample_rate_hz,
|
|
||||||
webrtc::AudioProcessing::ChannelLayout layout));
|
|
||||||
WEBRTC_STUB(ProcessReverseStream,
|
|
||||||
(const float* const* src,
|
|
||||||
const webrtc::StreamConfig& reverse_input_config,
|
|
||||||
const webrtc::StreamConfig& reverse_output_config,
|
|
||||||
float* const* dest));
|
|
||||||
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_VOID_STUB(set_delay_offset_ms, (int offset));
|
|
||||||
WEBRTC_STUB_CONST(delay_offset_ms, ());
|
|
||||||
WEBRTC_STUB(StartDebugRecording,
|
|
||||||
(const char filename[kMaxFilenameSize], int64_t max_size_bytes));
|
|
||||||
WEBRTC_STUB(StartDebugRecording, (FILE * handle, int64_t max_size_bytes));
|
|
||||||
WEBRTC_STUB(StartDebugRecording, (FILE * handle));
|
|
||||||
WEBRTC_STUB(StartDebugRecordingForPlatformFile, (rtc::PlatformFile handle));
|
|
||||||
WEBRTC_STUB(StopDebugRecording, ());
|
|
||||||
WEBRTC_VOID_STUB(UpdateHistogramsOnCallEnd, ());
|
|
||||||
webrtc::EchoCancellation* echo_cancellation() const override { return NULL; }
|
|
||||||
webrtc::EchoControlMobile* echo_control_mobile() const override {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
webrtc::GainControl* gain_control() const override { return NULL; }
|
|
||||||
webrtc::HighPassFilter* high_pass_filter() const override { return NULL; }
|
|
||||||
webrtc::LevelEstimator* level_estimator() const override { return NULL; }
|
|
||||||
webrtc::NoiseSuppression* noise_suppression() const override { return NULL; }
|
|
||||||
webrtc::VoiceDetection* voice_detection() const override { return NULL; }
|
|
||||||
|
|
||||||
bool experimental_ns_enabled() {
|
|
||||||
return experimental_ns_enabled_;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool experimental_ns_enabled_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class FakeWebRtcVoiceEngine
|
class FakeWebRtcVoiceEngine
|
||||||
: public webrtc::VoEAudioProcessing,
|
: public webrtc::VoEAudioProcessing,
|
||||||
public webrtc::VoEBase, public webrtc::VoECodec,
|
public webrtc::VoEBase, public webrtc::VoECodec,
|
||||||
@ -151,7 +63,7 @@ class FakeWebRtcVoiceEngine
|
|||||||
bool neteq_fast_accelerate = false;
|
bool neteq_fast_accelerate = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
FakeWebRtcVoiceEngine() {
|
explicit FakeWebRtcVoiceEngine(webrtc::AudioProcessing* apm) : apm_(apm) {
|
||||||
memset(&agc_config_, 0, sizeof(agc_config_));
|
memset(&agc_config_, 0, sizeof(agc_config_));
|
||||||
}
|
}
|
||||||
~FakeWebRtcVoiceEngine() override {
|
~FakeWebRtcVoiceEngine() override {
|
||||||
@ -190,7 +102,7 @@ class FakeWebRtcVoiceEngine
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
webrtc::AudioProcessing* audio_processing() override {
|
webrtc::AudioProcessing* audio_processing() override {
|
||||||
return &audio_processing_;
|
return apm_;
|
||||||
}
|
}
|
||||||
webrtc::AudioDeviceModule* audio_device_module() override {
|
webrtc::AudioDeviceModule* audio_device_module() override {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -344,7 +256,6 @@ class FakeWebRtcVoiceEngine
|
|||||||
mode = ns_mode_;
|
mode = ns_mode_;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WEBRTC_FUNC(SetAgcStatus, (bool enable, webrtc::AgcModes mode)) {
|
WEBRTC_FUNC(SetAgcStatus, (bool enable, webrtc::AgcModes mode)) {
|
||||||
agc_enabled_ = enable;
|
agc_enabled_ = enable;
|
||||||
agc_mode_ = mode;
|
agc_mode_ = mode;
|
||||||
@ -355,7 +266,6 @@ class FakeWebRtcVoiceEngine
|
|||||||
mode = agc_mode_;
|
mode = agc_mode_;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WEBRTC_FUNC(SetAgcConfig, (webrtc::AgcConfig config)) {
|
WEBRTC_FUNC(SetAgcConfig, (webrtc::AgcConfig config)) {
|
||||||
agc_config_ = config;
|
agc_config_ = config;
|
||||||
return 0;
|
return 0;
|
||||||
@ -397,11 +307,9 @@ class FakeWebRtcVoiceEngine
|
|||||||
WEBRTC_STUB(GetEchoMetrics, (int& ERL, int& ERLE, int& RERL, int& A_NLP));
|
WEBRTC_STUB(GetEchoMetrics, (int& ERL, int& ERLE, int& RERL, int& A_NLP));
|
||||||
WEBRTC_STUB(GetEcDelayMetrics, (int& delay_median, int& delay_std,
|
WEBRTC_STUB(GetEcDelayMetrics, (int& delay_median, int& delay_std,
|
||||||
float& fraction_poor_delays));
|
float& fraction_poor_delays));
|
||||||
|
|
||||||
WEBRTC_STUB(StartDebugRecording, (const char* fileNameUTF8));
|
WEBRTC_STUB(StartDebugRecording, (const char* fileNameUTF8));
|
||||||
WEBRTC_STUB(StartDebugRecording, (FILE* handle));
|
WEBRTC_STUB(StartDebugRecording, (FILE* handle));
|
||||||
WEBRTC_STUB(StopDebugRecording, ());
|
WEBRTC_STUB(StopDebugRecording, ());
|
||||||
|
|
||||||
WEBRTC_FUNC(SetTypingDetectionStatus, (bool enable)) {
|
WEBRTC_FUNC(SetTypingDetectionStatus, (bool enable)) {
|
||||||
typing_detection_enabled_ = enable;
|
typing_detection_enabled_ = enable;
|
||||||
return 0;
|
return 0;
|
||||||
@ -410,7 +318,6 @@ class FakeWebRtcVoiceEngine
|
|||||||
enabled = typing_detection_enabled_;
|
enabled = typing_detection_enabled_;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WEBRTC_STUB(TimeSinceLastTyping, (int& seconds));
|
WEBRTC_STUB(TimeSinceLastTyping, (int& seconds));
|
||||||
WEBRTC_STUB(SetTypingDetectionParameters, (int timeWindow,
|
WEBRTC_STUB(SetTypingDetectionParameters, (int timeWindow,
|
||||||
int costPerTyping,
|
int costPerTyping,
|
||||||
@ -459,7 +366,9 @@ class FakeWebRtcVoiceEngine
|
|||||||
webrtc::NsModes ns_mode_ = webrtc::kNsDefault;
|
webrtc::NsModes ns_mode_ = webrtc::kNsDefault;
|
||||||
webrtc::AgcModes agc_mode_ = webrtc::kAgcDefault;
|
webrtc::AgcModes agc_mode_ = webrtc::kAgcDefault;
|
||||||
webrtc::AgcConfig agc_config_;
|
webrtc::AgcConfig agc_config_;
|
||||||
FakeAudioProcessing audio_processing_;
|
webrtc::AudioProcessing* apm_ = nullptr;
|
||||||
|
|
||||||
|
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FakeWebRtcVoiceEngine);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cricket
|
} // namespace cricket
|
||||||
|
|||||||
@ -553,6 +553,9 @@ WebRtcVoiceEngine::WebRtcVoiceEngine(
|
|||||||
}
|
}
|
||||||
RTC_DCHECK(adm_);
|
RTC_DCHECK(adm_);
|
||||||
|
|
||||||
|
apm_ = voe_wrapper_->base()->audio_processing();
|
||||||
|
RTC_DCHECK(apm_);
|
||||||
|
|
||||||
// Save the default AGC configuration settings. This must happen before
|
// Save the default AGC configuration settings. This must happen before
|
||||||
// calling ApplyOptions or the default will be overwritten.
|
// calling ApplyOptions or the default will be overwritten.
|
||||||
int error = voe_wrapper_->processing()->GetAgcConfig(default_agc_config_);
|
int error = voe_wrapper_->processing()->GetAgcConfig(default_agc_config_);
|
||||||
@ -877,13 +880,8 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We check audioproc for the benefit of tests, since FakeWebRtcVoiceEngine
|
apm()->SetExtraOptions(config);
|
||||||
// returns NULL on audio_processing().
|
apm()->ApplyConfig(apm_config);
|
||||||
webrtc::AudioProcessing* audioproc = voe_wrapper_->base()->audio_processing();
|
|
||||||
if (audioproc) {
|
|
||||||
audioproc->SetExtraOptions(config);
|
|
||||||
audioproc->ApplyConfig(apm_config);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.recording_sample_rate) {
|
if (options.recording_sample_rate) {
|
||||||
LOG(LS_INFO) << "Recording sample rate is "
|
LOG(LS_INFO) << "Recording sample rate is "
|
||||||
@ -916,10 +914,8 @@ void WebRtcVoiceEngine::SetDefaultDevices() {
|
|||||||
LOG_RTCERR1(SetRecordingDevice, in_id);
|
LOG_RTCERR1(SetRecordingDevice, in_id);
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
webrtc::AudioProcessing* ap = voe()->base()->audio_processing();
|
|
||||||
if (ap) {
|
apm()->Initialize();
|
||||||
ap->Initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (voe_wrapper_->hw()->SetPlayoutDevice(out_id) == -1) {
|
if (voe_wrapper_->hw()->SetPlayoutDevice(out_id) == -1) {
|
||||||
LOG_RTCERR1(SetPlayoutDevice, out_id);
|
LOG_RTCERR1(SetPlayoutDevice, out_id);
|
||||||
@ -1040,8 +1036,7 @@ bool WebRtcVoiceEngine::StartAecDump(rtc::PlatformFile file,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
StopAecDump();
|
StopAecDump();
|
||||||
if (voe_wrapper_->base()->audio_processing()->StartDebugRecording(
|
if (apm()->StartDebugRecording(aec_dump_file_stream, max_size_bytes) !=
|
||||||
aec_dump_file_stream, max_size_bytes) !=
|
|
||||||
webrtc::AudioProcessing::kNoError) {
|
webrtc::AudioProcessing::kNoError) {
|
||||||
LOG_RTCERR0(StartDebugRecording);
|
LOG_RTCERR0(StartDebugRecording);
|
||||||
fclose(aec_dump_file_stream);
|
fclose(aec_dump_file_stream);
|
||||||
@ -1055,8 +1050,8 @@ void WebRtcVoiceEngine::StartAecDump(const std::string& filename) {
|
|||||||
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
|
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
|
||||||
if (!is_dumping_aec_) {
|
if (!is_dumping_aec_) {
|
||||||
// Start dumping AEC when we are not dumping.
|
// Start dumping AEC when we are not dumping.
|
||||||
if (voe_wrapper_->base()->audio_processing()->StartDebugRecording(
|
if (apm()->StartDebugRecording(filename.c_str(), -1) !=
|
||||||
filename.c_str(), -1) != webrtc::AudioProcessing::kNoError) {
|
webrtc::AudioProcessing::kNoError) {
|
||||||
LOG_RTCERR1(StartDebugRecording, filename.c_str());
|
LOG_RTCERR1(StartDebugRecording, filename.c_str());
|
||||||
} else {
|
} else {
|
||||||
is_dumping_aec_ = true;
|
is_dumping_aec_ = true;
|
||||||
@ -1068,8 +1063,7 @@ void WebRtcVoiceEngine::StopAecDump() {
|
|||||||
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
|
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
|
||||||
if (is_dumping_aec_) {
|
if (is_dumping_aec_) {
|
||||||
// Stop dumping AEC when we are dumping.
|
// Stop dumping AEC when we are dumping.
|
||||||
if (voe_wrapper_->base()->audio_processing()->StopDebugRecording() !=
|
if (apm()->StopDebugRecording() != webrtc::AudioProcessing::kNoError) {
|
||||||
webrtc::AudioProcessing::kNoError) {
|
|
||||||
LOG_RTCERR0(StopDebugRecording);
|
LOG_RTCERR0(StopDebugRecording);
|
||||||
}
|
}
|
||||||
is_dumping_aec_ = false;
|
is_dumping_aec_ = false;
|
||||||
@ -1087,6 +1081,12 @@ webrtc::AudioDeviceModule* WebRtcVoiceEngine::adm() {
|
|||||||
return adm_;
|
return adm_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
webrtc::AudioProcessing* WebRtcVoiceEngine::apm() {
|
||||||
|
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
|
||||||
|
RTC_DCHECK(apm_);
|
||||||
|
return apm_;
|
||||||
|
}
|
||||||
|
|
||||||
AudioCodecs WebRtcVoiceEngine::CollectRecvCodecs() const {
|
AudioCodecs WebRtcVoiceEngine::CollectRecvCodecs() const {
|
||||||
PayloadTypeMapper mapper;
|
PayloadTypeMapper mapper;
|
||||||
AudioCodecs out;
|
AudioCodecs out;
|
||||||
@ -2378,11 +2378,8 @@ bool WebRtcVoiceMediaChannel::MuteStream(uint32_t ssrc, bool muted) {
|
|||||||
for (const auto& kv : send_streams_) {
|
for (const auto& kv : send_streams_) {
|
||||||
all_muted = all_muted && kv.second->muted();
|
all_muted = all_muted && kv.second->muted();
|
||||||
}
|
}
|
||||||
|
engine()->apm()->set_output_will_be_muted(all_muted);
|
||||||
|
|
||||||
webrtc::AudioProcessing* ap = engine()->voe()->base()->audio_processing();
|
|
||||||
if (ap) {
|
|
||||||
ap->set_output_will_be_muted(all_muted);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -101,6 +101,7 @@ class WebRtcVoiceEngine final : public webrtc::TraceCallback {
|
|||||||
void StartAecDump(const std::string& filename);
|
void StartAecDump(const std::string& filename);
|
||||||
int CreateVoEChannel();
|
int CreateVoEChannel();
|
||||||
webrtc::AudioDeviceModule* adm();
|
webrtc::AudioDeviceModule* adm();
|
||||||
|
webrtc::AudioProcessing* apm();
|
||||||
|
|
||||||
AudioCodecs CollectRecvCodecs() const;
|
AudioCodecs CollectRecvCodecs() const;
|
||||||
|
|
||||||
@ -110,6 +111,8 @@ class WebRtcVoiceEngine final : public webrtc::TraceCallback {
|
|||||||
// The audio device manager.
|
// The audio device manager.
|
||||||
rtc::scoped_refptr<webrtc::AudioDeviceModule> adm_;
|
rtc::scoped_refptr<webrtc::AudioDeviceModule> adm_;
|
||||||
rtc::scoped_refptr<webrtc::AudioDecoderFactory> decoder_factory_;
|
rtc::scoped_refptr<webrtc::AudioDecoderFactory> decoder_factory_;
|
||||||
|
// Reference to the APM, owned by VoE.
|
||||||
|
webrtc::AudioProcessing* apm_ = nullptr;
|
||||||
// The primary instance of WebRtc VoiceEngine.
|
// The primary instance of WebRtc VoiceEngine.
|
||||||
std::unique_ptr<VoEWrapper> voe_wrapper_;
|
std::unique_ptr<VoEWrapper> voe_wrapper_;
|
||||||
rtc::scoped_refptr<webrtc::AudioState> audio_state_;
|
rtc::scoped_refptr<webrtc::AudioState> audio_state_;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -92,7 +92,7 @@ class AgcManagerDirectTest : public ::testing::Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MockAgc* agc_;
|
MockAgc* agc_;
|
||||||
MockGainControl gctrl_;
|
test::MockGainControl gctrl_;
|
||||||
TestVolumeCallbacks volume_;
|
TestVolumeCallbacks volume_;
|
||||||
AgcManagerDirect manager_;
|
AgcManagerDirect manager_;
|
||||||
test::TraceToStderr trace_to_stderr;
|
test::TraceToStderr trace_to_stderr;
|
||||||
|
|||||||
@ -14,257 +14,174 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "webrtc/modules/audio_processing/include/audio_processing.h"
|
#include "webrtc/modules/audio_processing/include/audio_processing.h"
|
||||||
|
#include "webrtc/test/gmock.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
namespace test {
|
||||||
|
|
||||||
class MockEchoCancellation : public EchoCancellation {
|
class MockEchoCancellation : public EchoCancellation {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD1(Enable,
|
virtual ~MockEchoCancellation() {}
|
||||||
int(bool enable));
|
MOCK_METHOD1(Enable, int(bool enable));
|
||||||
MOCK_CONST_METHOD0(is_enabled,
|
MOCK_CONST_METHOD0(is_enabled, bool());
|
||||||
bool());
|
MOCK_METHOD1(enable_drift_compensation, int(bool enable));
|
||||||
MOCK_METHOD1(enable_drift_compensation,
|
MOCK_CONST_METHOD0(is_drift_compensation_enabled, bool());
|
||||||
int(bool enable));
|
MOCK_METHOD1(set_stream_drift_samples, void(int drift));
|
||||||
MOCK_CONST_METHOD0(is_drift_compensation_enabled,
|
MOCK_CONST_METHOD0(stream_drift_samples, int());
|
||||||
bool());
|
MOCK_METHOD1(set_suppression_level, int(SuppressionLevel level));
|
||||||
MOCK_METHOD1(set_stream_drift_samples,
|
MOCK_CONST_METHOD0(suppression_level, SuppressionLevel());
|
||||||
void(int drift));
|
MOCK_CONST_METHOD0(stream_has_echo, bool());
|
||||||
MOCK_CONST_METHOD0(stream_drift_samples,
|
MOCK_METHOD1(enable_metrics, int(bool enable));
|
||||||
int());
|
MOCK_CONST_METHOD0(are_metrics_enabled, bool());
|
||||||
MOCK_METHOD1(set_suppression_level,
|
MOCK_METHOD1(GetMetrics, int(Metrics* metrics));
|
||||||
int(SuppressionLevel level));
|
MOCK_METHOD1(enable_delay_logging, int(bool enable));
|
||||||
MOCK_CONST_METHOD0(suppression_level,
|
MOCK_CONST_METHOD0(is_delay_logging_enabled, bool());
|
||||||
SuppressionLevel());
|
MOCK_METHOD2(GetDelayMetrics, int(int* median, int* std));
|
||||||
MOCK_CONST_METHOD0(stream_has_echo,
|
MOCK_METHOD3(GetDelayMetrics, int(int* median, int* std,
|
||||||
bool());
|
float* fraction_poor_delays));
|
||||||
MOCK_METHOD1(enable_metrics,
|
MOCK_CONST_METHOD0(aec_core, struct AecCore*());
|
||||||
int(bool enable));
|
|
||||||
MOCK_CONST_METHOD0(are_metrics_enabled,
|
|
||||||
bool());
|
|
||||||
MOCK_METHOD1(GetMetrics,
|
|
||||||
int(Metrics* metrics));
|
|
||||||
MOCK_METHOD1(enable_delay_logging,
|
|
||||||
int(bool enable));
|
|
||||||
MOCK_CONST_METHOD0(is_delay_logging_enabled,
|
|
||||||
bool());
|
|
||||||
MOCK_METHOD2(GetDelayMetrics,
|
|
||||||
int(int* median, int* std));
|
|
||||||
MOCK_METHOD3(GetDelayMetrics,
|
|
||||||
int(int* median, int* std, float* fraction_poor_delays));
|
|
||||||
MOCK_CONST_METHOD0(aec_core,
|
|
||||||
struct AecCore*());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MockEchoControlMobile : public EchoControlMobile {
|
class MockEchoControlMobile : public EchoControlMobile {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD1(Enable,
|
virtual ~MockEchoControlMobile() {}
|
||||||
int(bool enable));
|
MOCK_METHOD1(Enable, int(bool enable));
|
||||||
MOCK_CONST_METHOD0(is_enabled,
|
MOCK_CONST_METHOD0(is_enabled, bool());
|
||||||
bool());
|
MOCK_METHOD1(set_routing_mode, int(RoutingMode mode));
|
||||||
MOCK_METHOD1(set_routing_mode,
|
MOCK_CONST_METHOD0(routing_mode, RoutingMode());
|
||||||
int(RoutingMode mode));
|
MOCK_METHOD1(enable_comfort_noise, int(bool enable));
|
||||||
MOCK_CONST_METHOD0(routing_mode,
|
MOCK_CONST_METHOD0(is_comfort_noise_enabled, bool());
|
||||||
RoutingMode());
|
MOCK_METHOD2(SetEchoPath, int(const void* echo_path, size_t size_bytes));
|
||||||
MOCK_METHOD1(enable_comfort_noise,
|
MOCK_CONST_METHOD2(GetEchoPath, int(void* echo_path, size_t size_bytes));
|
||||||
int(bool enable));
|
|
||||||
MOCK_CONST_METHOD0(is_comfort_noise_enabled,
|
|
||||||
bool());
|
|
||||||
MOCK_METHOD2(SetEchoPath,
|
|
||||||
int(const void* echo_path, size_t size_bytes));
|
|
||||||
MOCK_CONST_METHOD2(GetEchoPath,
|
|
||||||
int(void* echo_path, size_t size_bytes));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MockGainControl : public GainControl {
|
class MockGainControl : public GainControl {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD1(Enable,
|
virtual ~MockGainControl() {}
|
||||||
int(bool enable));
|
MOCK_METHOD1(Enable, int(bool enable));
|
||||||
MOCK_CONST_METHOD0(is_enabled,
|
MOCK_CONST_METHOD0(is_enabled, bool());
|
||||||
bool());
|
MOCK_METHOD1(set_stream_analog_level, int(int level));
|
||||||
MOCK_METHOD1(set_stream_analog_level,
|
MOCK_METHOD0(stream_analog_level, int());
|
||||||
int(int level));
|
MOCK_METHOD1(set_mode, int(Mode mode));
|
||||||
MOCK_METHOD0(stream_analog_level,
|
MOCK_CONST_METHOD0(mode, Mode());
|
||||||
int());
|
MOCK_METHOD1(set_target_level_dbfs, int(int level));
|
||||||
MOCK_METHOD1(set_mode,
|
MOCK_CONST_METHOD0(target_level_dbfs, int());
|
||||||
int(Mode mode));
|
MOCK_METHOD1(set_compression_gain_db, int(int gain));
|
||||||
MOCK_CONST_METHOD0(mode,
|
MOCK_CONST_METHOD0(compression_gain_db, int());
|
||||||
Mode());
|
MOCK_METHOD1(enable_limiter, int(bool enable));
|
||||||
MOCK_METHOD1(set_target_level_dbfs,
|
MOCK_CONST_METHOD0(is_limiter_enabled, bool());
|
||||||
int(int level));
|
MOCK_METHOD2(set_analog_level_limits, int(int minimum, int maximum));
|
||||||
MOCK_CONST_METHOD0(target_level_dbfs,
|
MOCK_CONST_METHOD0(analog_level_minimum, int());
|
||||||
int());
|
MOCK_CONST_METHOD0(analog_level_maximum, int());
|
||||||
MOCK_METHOD1(set_compression_gain_db,
|
MOCK_CONST_METHOD0(stream_is_saturated, bool());
|
||||||
int(int gain));
|
|
||||||
MOCK_CONST_METHOD0(compression_gain_db,
|
|
||||||
int());
|
|
||||||
MOCK_METHOD1(enable_limiter,
|
|
||||||
int(bool enable));
|
|
||||||
MOCK_CONST_METHOD0(is_limiter_enabled,
|
|
||||||
bool());
|
|
||||||
MOCK_METHOD2(set_analog_level_limits,
|
|
||||||
int(int minimum, int maximum));
|
|
||||||
MOCK_CONST_METHOD0(analog_level_minimum,
|
|
||||||
int());
|
|
||||||
MOCK_CONST_METHOD0(analog_level_maximum,
|
|
||||||
int());
|
|
||||||
MOCK_CONST_METHOD0(stream_is_saturated,
|
|
||||||
bool());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MockHighPassFilter : public HighPassFilter {
|
class MockHighPassFilter : public HighPassFilter {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD1(Enable,
|
virtual ~MockHighPassFilter() {}
|
||||||
int(bool enable));
|
MOCK_METHOD1(Enable, int(bool enable));
|
||||||
MOCK_CONST_METHOD0(is_enabled,
|
MOCK_CONST_METHOD0(is_enabled, bool());
|
||||||
bool());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MockLevelEstimator : public LevelEstimator {
|
class MockLevelEstimator : public LevelEstimator {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD1(Enable,
|
virtual ~MockLevelEstimator() {}
|
||||||
int(bool enable));
|
MOCK_METHOD1(Enable, int(bool enable));
|
||||||
MOCK_CONST_METHOD0(is_enabled,
|
MOCK_CONST_METHOD0(is_enabled, bool());
|
||||||
bool());
|
MOCK_METHOD0(RMS, int());
|
||||||
MOCK_METHOD0(RMS,
|
|
||||||
int());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MockNoiseSuppression : public NoiseSuppression {
|
class MockNoiseSuppression : public NoiseSuppression {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD1(Enable,
|
virtual ~MockNoiseSuppression() {}
|
||||||
int(bool enable));
|
MOCK_METHOD1(Enable, int(bool enable));
|
||||||
MOCK_CONST_METHOD0(is_enabled,
|
MOCK_CONST_METHOD0(is_enabled, bool());
|
||||||
bool());
|
MOCK_METHOD1(set_level, int(Level level));
|
||||||
MOCK_METHOD1(set_level,
|
MOCK_CONST_METHOD0(level, Level());
|
||||||
int(Level level));
|
MOCK_CONST_METHOD0(speech_probability, float());
|
||||||
MOCK_CONST_METHOD0(level,
|
|
||||||
Level());
|
|
||||||
MOCK_CONST_METHOD0(speech_probability,
|
|
||||||
float());
|
|
||||||
MOCK_METHOD0(NoiseEstimate, std::vector<float>());
|
MOCK_METHOD0(NoiseEstimate, std::vector<float>());
|
||||||
};
|
};
|
||||||
|
|
||||||
class MockVoiceDetection : public VoiceDetection {
|
class MockVoiceDetection : public VoiceDetection {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD1(Enable,
|
virtual ~MockVoiceDetection() {}
|
||||||
int(bool enable));
|
MOCK_METHOD1(Enable, int(bool enable));
|
||||||
MOCK_CONST_METHOD0(is_enabled,
|
MOCK_CONST_METHOD0(is_enabled, bool());
|
||||||
bool());
|
MOCK_CONST_METHOD0(stream_has_voice, bool());
|
||||||
MOCK_CONST_METHOD0(stream_has_voice,
|
MOCK_METHOD1(set_stream_has_voice, int(bool has_voice));
|
||||||
bool());
|
MOCK_METHOD1(set_likelihood, int(Likelihood likelihood));
|
||||||
MOCK_METHOD1(set_stream_has_voice,
|
MOCK_CONST_METHOD0(likelihood, Likelihood());
|
||||||
int(bool has_voice));
|
MOCK_METHOD1(set_frame_size_ms, int(int size));
|
||||||
MOCK_METHOD1(set_likelihood,
|
MOCK_CONST_METHOD0(frame_size_ms, int());
|
||||||
int(Likelihood likelihood));
|
|
||||||
MOCK_CONST_METHOD0(likelihood,
|
|
||||||
Likelihood());
|
|
||||||
MOCK_METHOD1(set_frame_size_ms,
|
|
||||||
int(int size));
|
|
||||||
MOCK_CONST_METHOD0(frame_size_ms,
|
|
||||||
int());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MockAudioProcessing : public AudioProcessing {
|
class MockAudioProcessing : public AudioProcessing {
|
||||||
public:
|
public:
|
||||||
MockAudioProcessing()
|
MockAudioProcessing()
|
||||||
: echo_cancellation_(new MockEchoCancellation),
|
: echo_cancellation_(new testing::NiceMock<MockEchoCancellation>()),
|
||||||
echo_control_mobile_(new MockEchoControlMobile),
|
echo_control_mobile_(new testing::NiceMock<MockEchoControlMobile>()),
|
||||||
gain_control_(new MockGainControl),
|
gain_control_(new testing::NiceMock<MockGainControl>()),
|
||||||
high_pass_filter_(new MockHighPassFilter),
|
high_pass_filter_(new testing::NiceMock<MockHighPassFilter>()),
|
||||||
level_estimator_(new MockLevelEstimator),
|
level_estimator_(new testing::NiceMock<MockLevelEstimator>()),
|
||||||
noise_suppression_(new MockNoiseSuppression),
|
noise_suppression_(new testing::NiceMock<MockNoiseSuppression>()),
|
||||||
voice_detection_(new MockVoiceDetection) {
|
voice_detection_(new testing::NiceMock<MockVoiceDetection>()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~MockAudioProcessing() {
|
virtual ~MockAudioProcessing() {}
|
||||||
}
|
|
||||||
|
|
||||||
MOCK_METHOD0(Initialize,
|
MOCK_METHOD0(Initialize, int());
|
||||||
int());
|
MOCK_METHOD6(Initialize, int(int capture_input_sample_rate_hz,
|
||||||
MOCK_METHOD6(Initialize,
|
|
||||||
int(int capture_input_sample_rate_hz,
|
|
||||||
int capture_output_sample_rate_hz,
|
int capture_output_sample_rate_hz,
|
||||||
int render_sample_rate_hz,
|
int render_sample_rate_hz,
|
||||||
ChannelLayout capture_input_layout,
|
ChannelLayout capture_input_layout,
|
||||||
ChannelLayout capture_output_layout,
|
ChannelLayout capture_output_layout,
|
||||||
ChannelLayout render_input_layout));
|
ChannelLayout render_input_layout));
|
||||||
MOCK_METHOD1(Initialize,
|
MOCK_METHOD1(Initialize, int(const ProcessingConfig& processing_config));
|
||||||
int(const ProcessingConfig& processing_config));
|
|
||||||
MOCK_METHOD1(ApplyConfig, void(const Config& config));
|
MOCK_METHOD1(ApplyConfig, void(const Config& config));
|
||||||
MOCK_METHOD1(SetExtraOptions, void(const webrtc::Config& config));
|
MOCK_METHOD1(SetExtraOptions, void(const webrtc::Config& config));
|
||||||
MOCK_METHOD1(set_sample_rate_hz,
|
MOCK_CONST_METHOD0(proc_sample_rate_hz, int());
|
||||||
int(int rate));
|
MOCK_CONST_METHOD0(proc_split_sample_rate_hz, int());
|
||||||
MOCK_CONST_METHOD0(input_sample_rate_hz,
|
MOCK_CONST_METHOD0(num_input_channels, size_t());
|
||||||
int());
|
MOCK_CONST_METHOD0(num_proc_channels, size_t());
|
||||||
MOCK_CONST_METHOD0(sample_rate_hz,
|
MOCK_CONST_METHOD0(num_output_channels, size_t());
|
||||||
int());
|
MOCK_CONST_METHOD0(num_reverse_channels, size_t());
|
||||||
MOCK_CONST_METHOD0(proc_sample_rate_hz,
|
MOCK_METHOD1(set_output_will_be_muted, void(bool muted));
|
||||||
int());
|
MOCK_METHOD1(ProcessStream, int(AudioFrame* frame));
|
||||||
MOCK_CONST_METHOD0(proc_split_sample_rate_hz,
|
MOCK_METHOD7(ProcessStream, int(const float* const* src,
|
||||||
int());
|
|
||||||
MOCK_CONST_METHOD0(num_input_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_CONST_METHOD0(output_will_be_muted,
|
|
||||||
bool());
|
|
||||||
MOCK_METHOD1(ProcessStream,
|
|
||||||
int(AudioFrame* frame));
|
|
||||||
MOCK_METHOD7(ProcessStream,
|
|
||||||
int(const float* const* src,
|
|
||||||
size_t samples_per_channel,
|
size_t samples_per_channel,
|
||||||
int input_sample_rate_hz,
|
int input_sample_rate_hz,
|
||||||
ChannelLayout input_layout,
|
ChannelLayout input_layout,
|
||||||
int output_sample_rate_hz,
|
int output_sample_rate_hz,
|
||||||
ChannelLayout output_layout,
|
ChannelLayout output_layout,
|
||||||
float* const* dest));
|
float* const* dest));
|
||||||
MOCK_METHOD4(ProcessStream,
|
MOCK_METHOD4(ProcessStream, int(const float* const* src,
|
||||||
int(const float* const* src,
|
|
||||||
const StreamConfig& input_config,
|
const StreamConfig& input_config,
|
||||||
const StreamConfig& output_config,
|
const StreamConfig& output_config,
|
||||||
float* const* dest));
|
float* const* dest));
|
||||||
MOCK_METHOD1(AnalyzeReverseStream,
|
|
||||||
int(AudioFrame* frame));
|
|
||||||
MOCK_METHOD1(ProcessReverseStream, int(AudioFrame* frame));
|
MOCK_METHOD1(ProcessReverseStream, int(AudioFrame* frame));
|
||||||
MOCK_METHOD4(AnalyzeReverseStream,
|
MOCK_METHOD4(AnalyzeReverseStream, int(const float* const* data,
|
||||||
int(const float* const* data,
|
|
||||||
size_t samples_per_channel,
|
size_t samples_per_channel,
|
||||||
int sample_rate_hz,
|
int sample_rate_hz,
|
||||||
ChannelLayout layout));
|
ChannelLayout layout));
|
||||||
MOCK_METHOD4(ProcessReverseStream,
|
MOCK_METHOD4(ProcessReverseStream, int(const float* const* src,
|
||||||
int(const float* const* src,
|
|
||||||
const StreamConfig& input_config,
|
const StreamConfig& input_config,
|
||||||
const StreamConfig& output_config,
|
const StreamConfig& output_config,
|
||||||
float* const* dest));
|
float* const* dest));
|
||||||
MOCK_METHOD1(set_stream_delay_ms,
|
MOCK_METHOD1(set_stream_delay_ms, int(int delay));
|
||||||
int(int delay));
|
MOCK_CONST_METHOD0(stream_delay_ms, int());
|
||||||
MOCK_CONST_METHOD0(stream_delay_ms,
|
MOCK_CONST_METHOD0(was_stream_delay_set, bool());
|
||||||
int());
|
MOCK_METHOD1(set_stream_key_pressed, void(bool key_pressed));
|
||||||
MOCK_CONST_METHOD0(was_stream_delay_set,
|
MOCK_METHOD1(set_delay_offset_ms, void(int offset));
|
||||||
bool());
|
MOCK_CONST_METHOD0(delay_offset_ms, int());
|
||||||
MOCK_METHOD1(set_stream_key_pressed,
|
MOCK_METHOD2(StartDebugRecording, int(const char filename[kMaxFilenameSize],
|
||||||
void(bool key_pressed));
|
|
||||||
MOCK_CONST_METHOD0(stream_key_pressed,
|
|
||||||
bool());
|
|
||||||
MOCK_METHOD1(set_delay_offset_ms,
|
|
||||||
void(int offset));
|
|
||||||
MOCK_CONST_METHOD0(delay_offset_ms,
|
|
||||||
int());
|
|
||||||
MOCK_METHOD2(StartDebugRecording,
|
|
||||||
int(const char filename[kMaxFilenameSize],
|
|
||||||
int64_t max_log_size_bytes));
|
int64_t max_log_size_bytes));
|
||||||
MOCK_METHOD2(StartDebugRecording,
|
MOCK_METHOD2(StartDebugRecording, int(FILE* handle,
|
||||||
int(FILE* handle, int64_t max_log_size_bytes));
|
int64_t max_log_size_bytes));
|
||||||
MOCK_METHOD1(StartDebugRecording,
|
MOCK_METHOD1(StartDebugRecording, int (FILE* handle));
|
||||||
int (FILE* handle));
|
MOCK_METHOD1(StartDebugRecordingForPlatformFile,
|
||||||
MOCK_METHOD1(StartDebugRecording,
|
|
||||||
int(rtc::PlatformFile handle));
|
int(rtc::PlatformFile handle));
|
||||||
MOCK_METHOD0(StopDebugRecording,
|
MOCK_METHOD0(StopDebugRecording, int());
|
||||||
int());
|
|
||||||
MOCK_METHOD0(UpdateHistogramsOnCallEnd, void());
|
MOCK_METHOD0(UpdateHistogramsOnCallEnd, void());
|
||||||
virtual MockEchoCancellation* echo_cancellation() const {
|
virtual MockEchoCancellation* echo_cancellation() const {
|
||||||
return echo_cancellation_.get();
|
return echo_cancellation_.get();
|
||||||
@ -298,6 +215,7 @@ class MockAudioProcessing : public AudioProcessing {
|
|||||||
std::unique_ptr<MockVoiceDetection> voice_detection_;
|
std::unique_ptr<MockVoiceDetection> voice_detection_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace test
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_MOCK_AUDIO_PROCESSING_H_
|
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_MOCK_AUDIO_PROCESSING_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user