Remove echo_cancellation() and echo_control_mobile() interface access outside APM
Some of the AEC settings in WebRtcVoiceEngine agree with just about everywhere else and have therefore been set in stone inside AEC2/AECM. A lot of routing for those settings disappears. The comfort noise setting is exposed in the API, so the flag for it will be removed a PSA later. Bug: webrtc:9535 Change-Id: I53816152415a9a069cea9520cec697b6bcfe0948 Reviewed-on: https://webrtc-review.googlesource.com/101622 Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org> Commit-Queue: Sam Zackrisson <saza@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24863}
This commit is contained in:
parent
827cf3c1b2
commit
7988e5cbbf
@ -50,8 +50,6 @@ void ProcessCaptureFrame(uint32_t delay_ms,
|
||||
AudioFrame* audio_frame) {
|
||||
RTC_DCHECK(audio_processing);
|
||||
RTC_DCHECK(audio_frame);
|
||||
RTC_DCHECK(
|
||||
!audio_processing->echo_cancellation()->is_drift_compensation_enabled());
|
||||
audio_processing->set_stream_delay_ms(delay_ms);
|
||||
audio_processing->set_stream_key_pressed(key_pressed);
|
||||
int error = audio_processing->ProcessStream(audio_frame);
|
||||
|
||||
@ -25,9 +25,6 @@ void Init(AudioProcessing* apm) {
|
||||
|
||||
// This is the initialization which used to happen in VoEBase::Init(), but
|
||||
// which is not covered by the WVoE::ApplyOptions().
|
||||
if (apm->echo_cancellation()->enable_drift_compensation(false) != 0) {
|
||||
RTC_DLOG(LS_ERROR) << "Failed to disable drift compensation.";
|
||||
}
|
||||
GainControl* gc = apm->gain_control();
|
||||
if (gc->set_analog_level_limits(kMinVolumeLevel, kMaxVolumeLevel) != 0) {
|
||||
RTC_DLOG(LS_ERROR) << "Failed to set analog level limits with minimum: "
|
||||
@ -84,57 +81,14 @@ void SetAgcStatus(AudioProcessing* apm, bool enable) {
|
||||
void SetEcStatus(AudioProcessing* apm, bool enable, EcModes mode) {
|
||||
RTC_DCHECK(apm);
|
||||
RTC_DCHECK(mode == kEcConference || mode == kEcAecm) << "mode: " << mode;
|
||||
EchoCancellation* ec = apm->echo_cancellation();
|
||||
EchoControlMobile* ecm = apm->echo_control_mobile();
|
||||
if (mode == kEcConference) {
|
||||
// Disable the AECM before enabling the AEC.
|
||||
if (enable && ecm->is_enabled() && ecm->Enable(false) != 0) {
|
||||
RTC_LOG(LS_ERROR) << "Failed to disable AECM.";
|
||||
return;
|
||||
}
|
||||
if (ec->Enable(enable) != 0) {
|
||||
RTC_LOG(LS_ERROR) << "Failed to enable/disable AEC: " << enable;
|
||||
return;
|
||||
}
|
||||
if (ec->set_suppression_level(EchoCancellation::kHighSuppression) != 0) {
|
||||
RTC_LOG(LS_ERROR) << "Failed to set high AEC aggressiveness.";
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Disable the AEC before enabling the AECM.
|
||||
if (enable && ec->is_enabled() && ec->Enable(false) != 0) {
|
||||
RTC_LOG(LS_ERROR) << "Failed to disable AEC.";
|
||||
return;
|
||||
}
|
||||
if (ecm->Enable(enable) != 0) {
|
||||
RTC_LOG(LS_ERROR) << "Failed to enable/disable AECM: " << enable;
|
||||
return;
|
||||
}
|
||||
}
|
||||
AudioProcessing::Config apm_config = apm->GetConfig();
|
||||
apm_config.echo_canceller.enabled = enable;
|
||||
apm_config.echo_canceller.mobile_mode = (mode == kEcAecm);
|
||||
apm_config.echo_canceller.legacy_moderate_suppression_level = false;
|
||||
apm->ApplyConfig(apm_config);
|
||||
RTC_LOG(LS_INFO) << "Echo control set to " << enable << " with mode " << mode;
|
||||
}
|
||||
|
||||
void SetEcMetricsStatus(AudioProcessing* apm, bool enable) {
|
||||
RTC_DCHECK(apm);
|
||||
if ((apm->echo_cancellation()->enable_metrics(enable) != 0) ||
|
||||
(apm->echo_cancellation()->enable_delay_logging(enable) != 0)) {
|
||||
RTC_LOG(LS_ERROR) << "Failed to enable/disable EC metrics: " << enable;
|
||||
return;
|
||||
}
|
||||
RTC_LOG(LS_INFO) << "EC metrics set to " << enable;
|
||||
}
|
||||
|
||||
void SetAecmMode(AudioProcessing* apm, bool enable) {
|
||||
RTC_DCHECK(apm);
|
||||
EchoControlMobile* ecm = apm->echo_control_mobile();
|
||||
RTC_DCHECK_EQ(EchoControlMobile::kSpeakerphone, ecm->routing_mode());
|
||||
if (ecm->enable_comfort_noise(enable) != 0) {
|
||||
RTC_LOG(LS_ERROR) << "Failed to enable/disable CNG: " << enable;
|
||||
return;
|
||||
}
|
||||
RTC_LOG(LS_INFO) << "CNG set to " << enable;
|
||||
}
|
||||
|
||||
void SetNsStatus(AudioProcessing* apm, bool enable) {
|
||||
RTC_DCHECK(apm);
|
||||
NoiseSuppression* ns = apm->noise_suppression();
|
||||
|
||||
@ -34,25 +34,6 @@ struct TestHelper {
|
||||
|
||||
const AudioProcessing* apm() const { return apm_.get(); }
|
||||
|
||||
bool GetEcMetricsStatus() const {
|
||||
EchoCancellation* ec = apm()->echo_cancellation();
|
||||
bool metrics_enabled = ec->are_metrics_enabled();
|
||||
EXPECT_EQ(metrics_enabled, ec->is_delay_logging_enabled());
|
||||
return metrics_enabled;
|
||||
}
|
||||
|
||||
bool CanGetEcMetrics() const {
|
||||
EchoCancellation* ec = apm()->echo_cancellation();
|
||||
EchoCancellation::Metrics metrics;
|
||||
int metrics_result = ec->GetMetrics(&metrics);
|
||||
int median = 0;
|
||||
int std = 0;
|
||||
float fraction = 0;
|
||||
int delay_metrics_result = ec->GetDelayMetrics(&median, &std, &fraction);
|
||||
return metrics_result == AudioProcessing::kNoError &&
|
||||
delay_metrics_result == AudioProcessing::kNoError;
|
||||
}
|
||||
|
||||
private:
|
||||
rtc::scoped_refptr<AudioProcessing> apm_;
|
||||
};
|
||||
@ -151,52 +132,6 @@ TEST(ApmHelpersTest, EcStatus_EnableDisable) {
|
||||
EXPECT_TRUE(ecm->is_enabled());
|
||||
}
|
||||
|
||||
TEST(ApmHelpersTest, EcMetrics_DefaultMode) {
|
||||
TestHelper helper;
|
||||
apm_helpers::SetEcStatus(helper.apm(), true, kEcConference);
|
||||
EXPECT_TRUE(helper.GetEcMetricsStatus());
|
||||
}
|
||||
|
||||
TEST(ApmHelpersTest, EcMetrics_CanEnableDisable) {
|
||||
TestHelper helper;
|
||||
apm_helpers::SetEcStatus(helper.apm(), true, kEcConference);
|
||||
|
||||
apm_helpers::SetEcMetricsStatus(helper.apm(), true);
|
||||
EXPECT_TRUE(helper.GetEcMetricsStatus());
|
||||
apm_helpers::SetEcMetricsStatus(helper.apm(), false);
|
||||
EXPECT_FALSE(helper.GetEcMetricsStatus());
|
||||
}
|
||||
|
||||
TEST(ApmHelpersTest, EcMetrics_NoStatsUnlessEcMetricsAndEcEnabled) {
|
||||
TestHelper helper;
|
||||
EXPECT_FALSE(helper.CanGetEcMetrics());
|
||||
|
||||
apm_helpers::SetEcMetricsStatus(helper.apm(), true);
|
||||
EXPECT_FALSE(helper.CanGetEcMetrics());
|
||||
|
||||
apm_helpers::SetEcStatus(helper.apm(), true, kEcConference);
|
||||
EXPECT_TRUE(helper.CanGetEcMetrics());
|
||||
|
||||
apm_helpers::SetEcMetricsStatus(helper.apm(), false);
|
||||
EXPECT_FALSE(helper.CanGetEcMetrics());
|
||||
}
|
||||
|
||||
TEST(ApmHelpersTest, AecmMode_DefaultMode) {
|
||||
TestHelper helper;
|
||||
EchoControlMobile* ecm = helper.apm()->echo_control_mobile();
|
||||
EXPECT_EQ(EchoControlMobile::kSpeakerphone, ecm->routing_mode());
|
||||
EXPECT_FALSE(ecm->is_comfort_noise_enabled());
|
||||
}
|
||||
|
||||
TEST(ApmHelpersTest, AecmMode_EnableDisableCng) {
|
||||
TestHelper helper;
|
||||
EchoControlMobile* ecm = helper.apm()->echo_control_mobile();
|
||||
apm_helpers::SetAecmMode(helper.apm(), false);
|
||||
EXPECT_FALSE(ecm->is_comfort_noise_enabled());
|
||||
apm_helpers::SetAecmMode(helper.apm(), true);
|
||||
EXPECT_TRUE(ecm->is_comfort_noise_enabled());
|
||||
}
|
||||
|
||||
TEST(ApmHelpersTest, NsStatus_DefaultMode) {
|
||||
TestHelper helper;
|
||||
NoiseSuppression* ns = helper.apm()->noise_suppression();
|
||||
|
||||
@ -320,10 +320,10 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
|
||||
// Set and adjust echo canceller options.
|
||||
// kEcConference is AEC with high suppression.
|
||||
webrtc::EcModes ec_mode = webrtc::kEcConference;
|
||||
if (options.aecm_generate_comfort_noise) {
|
||||
RTC_LOG(LS_VERBOSE) << "Comfort noise explicitly set to "
|
||||
<< *options.aecm_generate_comfort_noise
|
||||
<< " (default is false).";
|
||||
if (options.aecm_generate_comfort_noise &&
|
||||
*options.aecm_generate_comfort_noise) {
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Ignoring deprecated mobile AEC setting: comfort noise";
|
||||
}
|
||||
|
||||
#if defined(WEBRTC_IOS)
|
||||
@ -425,13 +425,6 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
|
||||
}
|
||||
webrtc::apm_helpers::SetEcStatus(apm(), *options.echo_cancellation,
|
||||
ec_mode);
|
||||
#if !defined(WEBRTC_ANDROID)
|
||||
webrtc::apm_helpers::SetEcMetricsStatus(apm(), *options.echo_cancellation);
|
||||
#endif
|
||||
if (ec_mode == webrtc::kEcAecm) {
|
||||
bool cn = options.aecm_generate_comfort_noise.value_or(false);
|
||||
webrtc::apm_helpers::SetAecmMode(apm(), cn);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.auto_gain_control) {
|
||||
|
||||
@ -168,7 +168,6 @@ class WebRtcVoiceEngineTestFake : public testing::Test {
|
||||
: apm_(new rtc::RefCountedObject<
|
||||
StrictMock<webrtc::test::MockAudioProcessing>>()),
|
||||
apm_gc_(*apm_->gain_control()),
|
||||
apm_ec_(*apm_->echo_cancellation()),
|
||||
apm_ns_(*apm_->noise_suppression()),
|
||||
apm_vd_(*apm_->voice_detection()),
|
||||
call_(),
|
||||
@ -181,9 +180,6 @@ class WebRtcVoiceEngineTestFake : public testing::Test {
|
||||
EXPECT_CALL(*apm_, SetExtraOptions(testing::_));
|
||||
EXPECT_CALL(*apm_, DetachAecDump());
|
||||
// Default Options.
|
||||
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_drift_compensation(false)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, set_analog_level_limits(0, 255)).WillOnce(Return(0));
|
||||
@ -208,6 +204,7 @@ class WebRtcVoiceEngineTestFake : public testing::Test {
|
||||
recv_parameters_.codecs.push_back(kPcmuCodec);
|
||||
|
||||
// Default Options.
|
||||
EXPECT_TRUE(IsEchoCancellationEnabled());
|
||||
EXPECT_TRUE(IsHighPassFilterEnabled());
|
||||
}
|
||||
|
||||
@ -711,6 +708,10 @@ class WebRtcVoiceEngineTestFake : public testing::Test {
|
||||
}
|
||||
}
|
||||
|
||||
bool IsEchoCancellationEnabled() {
|
||||
return engine_->GetApmConfigForTest().echo_canceller.enabled;
|
||||
}
|
||||
|
||||
bool IsHighPassFilterEnabled() {
|
||||
return engine_->GetApmConfigForTest().high_pass_filter.enabled;
|
||||
}
|
||||
@ -719,7 +720,6 @@ class WebRtcVoiceEngineTestFake : public testing::Test {
|
||||
StrictMock<webrtc::test::MockAudioDeviceModule> adm_;
|
||||
rtc::scoped_refptr<StrictMock<webrtc::test::MockAudioProcessing>> apm_;
|
||||
webrtc::test::MockGainControl& apm_gc_;
|
||||
webrtc::test::MockEchoCancellation& apm_ec_;
|
||||
webrtc::test::MockNoiseSuppression& apm_ns_;
|
||||
webrtc::test::MockVoiceDetection& apm_vd_;
|
||||
cricket::FakeCall call_;
|
||||
@ -2818,63 +2818,55 @@ TEST_F(WebRtcVoiceEngineTestFake, SetAudioOptions) {
|
||||
// Nothing set in AudioOptions, so everything should be as default.
|
||||
send_parameters_.options = cricket::AudioOptions();
|
||||
SetSendParameters(send_parameters_);
|
||||
EXPECT_TRUE(IsEchoCancellationEnabled());
|
||||
EXPECT_TRUE(IsHighPassFilterEnabled());
|
||||
EXPECT_EQ(50u, GetRecvStreamConfig(kSsrcY).jitter_buffer_max_packets);
|
||||
EXPECT_FALSE(GetRecvStreamConfig(kSsrcY).jitter_buffer_fast_accelerate);
|
||||
|
||||
// Turn echo cancellation off
|
||||
EXPECT_CALL(apm_ec_, Enable(false)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_metrics(false)).WillOnce(Return(0));
|
||||
send_parameters_.options.echo_cancellation = false;
|
||||
SetSendParameters(send_parameters_);
|
||||
EXPECT_FALSE(IsEchoCancellationEnabled());
|
||||
|
||||
// Turn echo cancellation back on, with settings, and make sure
|
||||
// nothing else changed.
|
||||
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
|
||||
send_parameters_.options.echo_cancellation = true;
|
||||
SetSendParameters(send_parameters_);
|
||||
EXPECT_TRUE(IsEchoCancellationEnabled());
|
||||
|
||||
// Turn on delay agnostic aec and make sure nothing change w.r.t. echo
|
||||
// control.
|
||||
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
|
||||
send_parameters_.options.delay_agnostic_aec = true;
|
||||
SetSendParameters(send_parameters_);
|
||||
EXPECT_TRUE(IsEchoCancellationEnabled());
|
||||
|
||||
// Turn off echo cancellation and delay agnostic aec.
|
||||
EXPECT_CALL(apm_ec_, Enable(false)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_metrics(false)).WillOnce(Return(0));
|
||||
send_parameters_.options.delay_agnostic_aec = false;
|
||||
send_parameters_.options.extended_filter_aec = false;
|
||||
send_parameters_.options.echo_cancellation = false;
|
||||
SetSendParameters(send_parameters_);
|
||||
EXPECT_FALSE(IsEchoCancellationEnabled());
|
||||
|
||||
// Turning delay agnostic aec back on should also turn on echo cancellation.
|
||||
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
|
||||
send_parameters_.options.delay_agnostic_aec = true;
|
||||
SetSendParameters(send_parameters_);
|
||||
EXPECT_TRUE(IsEchoCancellationEnabled());
|
||||
|
||||
// Turn off AGC
|
||||
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, Enable(false)).WillOnce(Return(0));
|
||||
send_parameters_.options.auto_gain_control = false;
|
||||
SetSendParameters(send_parameters_);
|
||||
EXPECT_TRUE(IsEchoCancellationEnabled());
|
||||
|
||||
// Turn AGC back on
|
||||
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, Enable(true)).WillOnce(Return(0));
|
||||
send_parameters_.options.auto_gain_control = true;
|
||||
SetSendParameters(send_parameters_);
|
||||
EXPECT_TRUE(IsEchoCancellationEnabled());
|
||||
|
||||
// Turn off other options.
|
||||
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).WillOnce(Return(0));
|
||||
@ -2885,17 +2877,17 @@ TEST_F(WebRtcVoiceEngineTestFake, SetAudioOptions) {
|
||||
send_parameters_.options.typing_detection = false;
|
||||
send_parameters_.options.stereo_swapping = true;
|
||||
SetSendParameters(send_parameters_);
|
||||
EXPECT_TRUE(IsEchoCancellationEnabled());
|
||||
EXPECT_FALSE(IsHighPassFilterEnabled());
|
||||
|
||||
// Set options again to ensure it has no impact.
|
||||
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ns_, Enable(false)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_vd_, Enable(false)).WillOnce(Return(0));
|
||||
SetSendParameters(send_parameters_);
|
||||
EXPECT_TRUE(IsEchoCancellationEnabled());
|
||||
}
|
||||
|
||||
TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) {
|
||||
@ -2916,10 +2908,8 @@ TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) {
|
||||
EXPECT_CALL(adm_, InitRecording()).Times(2).WillRepeatedly(Return(0));
|
||||
webrtc::AudioProcessing::Config apm_config;
|
||||
EXPECT_CALL(*apm_, GetConfig())
|
||||
.Times(10)
|
||||
.WillRepeatedly(ReturnPointee(&apm_config));
|
||||
EXPECT_CALL(*apm_, ApplyConfig(_))
|
||||
.Times(10)
|
||||
.WillRepeatedly(SaveArg<0>(&apm_config));
|
||||
EXPECT_CALL(*apm_, SetExtraOptions(testing::_)).Times(10);
|
||||
|
||||
@ -2943,27 +2933,26 @@ TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) {
|
||||
parameters_options_all.options.echo_cancellation = true;
|
||||
parameters_options_all.options.auto_gain_control = true;
|
||||
parameters_options_all.options.noise_suppression = true;
|
||||
EXPECT_CALL(apm_ec_, Enable(true)).Times(2).WillRepeatedly(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_metrics(true)).Times(2).WillRepeatedly(Return(0));
|
||||
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).Times(2).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, Enable(true)).Times(2).WillRepeatedly(Return(0));
|
||||
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).Times(2).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ns_, Enable(true)).Times(2).WillRepeatedly(Return(0));
|
||||
EXPECT_TRUE(channel1->SetSendParameters(parameters_options_all));
|
||||
EXPECT_TRUE(IsEchoCancellationEnabled());
|
||||
EXPECT_EQ(parameters_options_all.options, channel1->options());
|
||||
EXPECT_TRUE(channel2->SetSendParameters(parameters_options_all));
|
||||
EXPECT_TRUE(IsEchoCancellationEnabled());
|
||||
EXPECT_EQ(parameters_options_all.options, channel2->options());
|
||||
|
||||
// unset NS
|
||||
cricket::AudioSendParameters parameters_options_no_ns = send_parameters_;
|
||||
parameters_options_no_ns.options.noise_suppression = false;
|
||||
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ns_, Enable(false)).WillOnce(Return(0));
|
||||
EXPECT_TRUE(channel1->SetSendParameters(parameters_options_no_ns));
|
||||
EXPECT_TRUE(IsEchoCancellationEnabled());
|
||||
cricket::AudioOptions expected_options = parameters_options_all.options;
|
||||
expected_options.echo_cancellation = true;
|
||||
expected_options.auto_gain_control = true;
|
||||
@ -2973,54 +2962,49 @@ TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) {
|
||||
// unset AGC
|
||||
cricket::AudioSendParameters parameters_options_no_agc = send_parameters_;
|
||||
parameters_options_no_agc.options.auto_gain_control = false;
|
||||
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, Enable(false)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ns_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_TRUE(channel2->SetSendParameters(parameters_options_no_agc));
|
||||
EXPECT_TRUE(IsEchoCancellationEnabled());
|
||||
expected_options.echo_cancellation = true;
|
||||
expected_options.auto_gain_control = false;
|
||||
expected_options.noise_suppression = true;
|
||||
EXPECT_EQ(expected_options, channel2->options());
|
||||
|
||||
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ns_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_TRUE(channel_->SetSendParameters(parameters_options_all));
|
||||
EXPECT_TRUE(IsEchoCancellationEnabled());
|
||||
|
||||
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ns_, Enable(false)).WillOnce(Return(0));
|
||||
channel1->SetSend(true);
|
||||
EXPECT_TRUE(IsEchoCancellationEnabled());
|
||||
|
||||
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, Enable(false)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ns_, Enable(true)).WillOnce(Return(0));
|
||||
channel2->SetSend(true);
|
||||
EXPECT_TRUE(IsEchoCancellationEnabled());
|
||||
|
||||
// Make sure settings take effect while we are sending.
|
||||
cricket::AudioSendParameters parameters_options_no_agc_nor_ns =
|
||||
send_parameters_;
|
||||
parameters_options_no_agc_nor_ns.options.auto_gain_control = false;
|
||||
parameters_options_no_agc_nor_ns.options.noise_suppression = false;
|
||||
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_gc_, Enable(false)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).WillOnce(Return(0));
|
||||
EXPECT_CALL(apm_ns_, Enable(false)).WillOnce(Return(0));
|
||||
EXPECT_TRUE(channel2->SetSendParameters(parameters_options_no_agc_nor_ns));
|
||||
EXPECT_TRUE(IsEchoCancellationEnabled());
|
||||
expected_options.echo_cancellation = true;
|
||||
expected_options.auto_gain_control = false;
|
||||
expected_options.noise_suppression = false;
|
||||
@ -3036,10 +3020,8 @@ TEST_F(WebRtcVoiceEngineTestFake, TestSetDscpOptions) {
|
||||
|
||||
webrtc::AudioProcessing::Config apm_config;
|
||||
EXPECT_CALL(*apm_, GetConfig())
|
||||
.Times(3)
|
||||
.WillRepeatedly(ReturnPointee(&apm_config));
|
||||
EXPECT_CALL(*apm_, ApplyConfig(_))
|
||||
.Times(3)
|
||||
.WillRepeatedly(SaveArg<0>(&apm_config));
|
||||
EXPECT_CALL(*apm_, SetExtraOptions(testing::_)).Times(3);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user