Completed rewrite of APM extended test.
Removed NS tests since they are already covered by audio_processing_test. BUG= TEST= Review URL: https://webrtc-codereview.appspot.com/603004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2308 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
1747427861
commit
dbaa893525
109
src/voice_engine/main/test/auto_test/extended/agc_config_test.cc
Normal file
109
src/voice_engine/main/test/auto_test/extended/agc_config_test.cc
Normal file
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 "voice_engine/main/test/auto_test/fixtures/after_streaming_fixture.h"
|
||||
|
||||
class AgcConfigTest : public AfterStreamingFixture {
|
||||
protected:
|
||||
void SetUp() {
|
||||
// These should be defaults for the AGC config.
|
||||
default_agc_config_.digitalCompressionGaindB = 9;
|
||||
default_agc_config_.limiterEnable = true;
|
||||
default_agc_config_.targetLeveldBOv = 3;
|
||||
}
|
||||
|
||||
webrtc::AgcConfig default_agc_config_;
|
||||
};
|
||||
|
||||
TEST_F(AgcConfigTest, HasCorrectDefaultConfiguration) {
|
||||
webrtc::AgcConfig agc_config;
|
||||
|
||||
EXPECT_EQ(0, voe_apm_->GetAgcConfig(agc_config));
|
||||
|
||||
EXPECT_EQ(default_agc_config_.targetLeveldBOv, agc_config.targetLeveldBOv);
|
||||
EXPECT_EQ(default_agc_config_.digitalCompressionGaindB,
|
||||
agc_config.digitalCompressionGaindB);
|
||||
EXPECT_EQ(default_agc_config_.limiterEnable, agc_config.limiterEnable);
|
||||
}
|
||||
|
||||
TEST_F(AgcConfigTest, DealsWithInvalidParameters) {
|
||||
webrtc::AgcConfig agc_config = default_agc_config_;
|
||||
agc_config.digitalCompressionGaindB = 91;
|
||||
EXPECT_EQ(-1, voe_apm_->SetAgcConfig(agc_config)) << "Should not be able "
|
||||
"to set gain to more than 90 dB.";
|
||||
EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError());
|
||||
|
||||
agc_config = default_agc_config_;
|
||||
agc_config.targetLeveldBOv = 32;
|
||||
EXPECT_EQ(-1, voe_apm_->SetAgcConfig(agc_config)) << "Should not be able "
|
||||
"to set target level to more than 31.";
|
||||
EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError());
|
||||
}
|
||||
|
||||
TEST_F(AgcConfigTest, CanGetAndSetAgcStatus) {
|
||||
webrtc::AgcConfig agc_config;
|
||||
agc_config.digitalCompressionGaindB = 17;
|
||||
agc_config.targetLeveldBOv = 11;
|
||||
agc_config.limiterEnable = false;
|
||||
|
||||
webrtc::AgcConfig actual_config;
|
||||
EXPECT_EQ(0, voe_apm_->SetAgcConfig(agc_config));
|
||||
EXPECT_EQ(0, voe_apm_->GetAgcConfig(actual_config));
|
||||
|
||||
EXPECT_EQ(agc_config.digitalCompressionGaindB,
|
||||
actual_config.digitalCompressionGaindB);
|
||||
EXPECT_EQ(agc_config.limiterEnable,
|
||||
actual_config.limiterEnable);
|
||||
EXPECT_EQ(agc_config.targetLeveldBOv,
|
||||
actual_config.targetLeveldBOv);
|
||||
}
|
||||
|
||||
TEST_F(AgcConfigTest, HasCorrectDefaultRxConfiguration) {
|
||||
webrtc::AgcConfig agc_config;
|
||||
|
||||
EXPECT_EQ(0, voe_apm_->GetRxAgcConfig(channel_, agc_config));
|
||||
|
||||
EXPECT_EQ(default_agc_config_.targetLeveldBOv, agc_config.targetLeveldBOv);
|
||||
EXPECT_EQ(default_agc_config_.digitalCompressionGaindB,
|
||||
agc_config.digitalCompressionGaindB);
|
||||
EXPECT_EQ(default_agc_config_.limiterEnable, agc_config.limiterEnable);
|
||||
}
|
||||
|
||||
TEST_F(AgcConfigTest, DealsWithInvalidRxParameters) {
|
||||
webrtc::AgcConfig agc_config = default_agc_config_;
|
||||
agc_config.digitalCompressionGaindB = 91;
|
||||
EXPECT_EQ(-1, voe_apm_->SetRxAgcConfig(channel_, agc_config)) <<
|
||||
"Should not be able to set RX gain to more than 90 dB.";
|
||||
EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError());
|
||||
|
||||
agc_config = default_agc_config_;
|
||||
agc_config.targetLeveldBOv = 32;
|
||||
EXPECT_EQ(-1, voe_apm_->SetRxAgcConfig(channel_, agc_config)) <<
|
||||
"Should not be able to set target level to more than 31.";
|
||||
EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError());
|
||||
}
|
||||
|
||||
TEST_F(AgcConfigTest, CanGetAndSetRxAgcStatus) {
|
||||
webrtc::AgcConfig agc_config;
|
||||
agc_config.digitalCompressionGaindB = 17;
|
||||
agc_config.targetLeveldBOv = 11;
|
||||
agc_config.limiterEnable = false;
|
||||
|
||||
webrtc::AgcConfig actual_config;
|
||||
EXPECT_EQ(0, voe_apm_->SetRxAgcConfig(channel_, agc_config));
|
||||
EXPECT_EQ(0, voe_apm_->GetRxAgcConfig(channel_, actual_config));
|
||||
|
||||
EXPECT_EQ(agc_config.digitalCompressionGaindB,
|
||||
actual_config.digitalCompressionGaindB);
|
||||
EXPECT_EQ(agc_config.limiterEnable,
|
||||
actual_config.limiterEnable);
|
||||
EXPECT_EQ(agc_config.targetLeveldBOv,
|
||||
actual_config.targetLeveldBOv);
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 "voice_engine/main/test/auto_test/fixtures/after_streaming_fixture.h"
|
||||
|
||||
class EcMetricsTest : public AfterStreamingFixture {
|
||||
};
|
||||
|
||||
TEST_F(EcMetricsTest, EcMetricsAreOffByDefault) {
|
||||
bool enabled = true;
|
||||
EXPECT_EQ(0, voe_apm_->GetEcMetricsStatus(enabled));
|
||||
EXPECT_FALSE(enabled);
|
||||
}
|
||||
|
||||
TEST_F(EcMetricsTest, CanEnableAndDisableEcMetrics) {
|
||||
EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
|
||||
bool ec_on = false;
|
||||
EXPECT_EQ(0, voe_apm_->GetEcMetricsStatus(ec_on));
|
||||
ASSERT_TRUE(ec_on);
|
||||
EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(false));
|
||||
EXPECT_EQ(0, voe_apm_->GetEcMetricsStatus(ec_on));
|
||||
ASSERT_FALSE(ec_on);
|
||||
}
|
||||
|
||||
TEST_F(EcMetricsTest, ManualTestEcMetrics) {
|
||||
SwitchToManualMicrophone();
|
||||
|
||||
EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
|
||||
|
||||
// Must enable AEC to get valid echo metrics.
|
||||
EXPECT_EQ(0, voe_apm_->SetEcStatus(true, webrtc::kEcAec));
|
||||
|
||||
TEST_LOG("Speak into microphone and check metrics for 5 seconds...\n");
|
||||
int erl, erle, rerl, a_nlp;
|
||||
int delay_median = 0;
|
||||
int delay_std = 0;
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
Sleep(1000);
|
||||
EXPECT_EQ(0, voe_apm_->GetEchoMetrics(erl, erle, rerl, a_nlp));
|
||||
EXPECT_EQ(0, voe_apm_->GetEcDelayMetrics(delay_median, delay_std));
|
||||
TEST_LOG(" Echo : ERL=%5d, ERLE=%5d, RERL=%5d, A_NLP=%5d [dB], "
|
||||
" delay median=%3d, delay std=%3d [ms]\n", erl, erle, rerl, a_nlp,
|
||||
delay_median, delay_std);
|
||||
}
|
||||
|
||||
EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(false));
|
||||
}
|
||||
|
||||
TEST_F(EcMetricsTest, GetEcMetricsFailsIfEcNotEnabled) {
|
||||
int dummy = 0;
|
||||
EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
|
||||
EXPECT_EQ(-1, voe_apm_->GetEchoMetrics(dummy, dummy, dummy, dummy));
|
||||
EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError());
|
||||
}
|
||||
|
||||
TEST_F(EcMetricsTest, GetEcDelayMetricsFailsIfEcNotEnabled) {
|
||||
int dummy = 0;
|
||||
EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
|
||||
EXPECT_EQ(-1, voe_apm_->GetEcDelayMetrics(dummy, dummy));
|
||||
EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError());
|
||||
}
|
||||
|
||||
TEST_F(EcMetricsTest, ManualVerifyEcDelayMetrics) {
|
||||
SwitchToManualMicrophone();
|
||||
TEST_LOG("Verify EC Delay metrics:");
|
||||
EXPECT_EQ(0, voe_apm_->SetEcStatus(true));
|
||||
EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
int delay, delay_std;
|
||||
EXPECT_EQ(0, voe_apm_->GetEcDelayMetrics(delay, delay_std));
|
||||
TEST_LOG("Delay = %d, Delay Std = %d\n", delay, delay_std);
|
||||
Sleep(1000);
|
||||
}
|
||||
}
|
@ -8,8 +8,9 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "after_streaming_fixture.h"
|
||||
#include "voe_standard_test.h"
|
||||
#include "testsupport/fileutils.h"
|
||||
#include "voice_engine/main/test/auto_test/fixtures/after_streaming_fixture.h"
|
||||
#include "voice_engine/main/test/auto_test/voe_standard_test.h"
|
||||
|
||||
class RxCallback : public webrtc::VoERxVadCallback {
|
||||
public:
|
||||
@ -171,35 +172,31 @@ TEST_F(AudioProcessingTest, EnablingEcConferenceShouldEnableEcAec) {
|
||||
TryEnablingEcWithMode(webrtc::kEcConference, webrtc::kEcAec);
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, EcMetricsAreOffByDefault) {
|
||||
bool enabled = true;
|
||||
EXPECT_EQ(0, voe_apm_->GetEcMetricsStatus(enabled));
|
||||
EXPECT_FALSE(enabled);
|
||||
TEST_F(AudioProcessingTest, EcModeIsPreservedWhenEcIsTurnedOff) {
|
||||
TryEnablingEcWithMode(webrtc::kEcConference, webrtc::kEcAec);
|
||||
|
||||
EXPECT_EQ(0, voe_apm_->SetEcStatus(false));
|
||||
|
||||
bool ec_enabled = true;
|
||||
webrtc::EcModes ec_mode = webrtc::kEcDefault;
|
||||
EXPECT_EQ(0, voe_apm_->GetEcStatus(ec_enabled, ec_mode));
|
||||
|
||||
EXPECT_FALSE(ec_enabled);
|
||||
EXPECT_EQ(webrtc::kEcAec, ec_mode);
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, ManualTestEcMetrics) {
|
||||
SwitchToManualMicrophone();
|
||||
|
||||
EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
|
||||
|
||||
// Must enable AEC to get valid echo metrics.
|
||||
EXPECT_EQ(0, voe_apm_->SetEcStatus(true, webrtc::kEcAec));
|
||||
|
||||
TEST_LOG("Speak into microphone and check metrics for 10 seconds...\n");
|
||||
int erl, erle, rerl, a_nlp;
|
||||
int delay_median = 0;
|
||||
int delay_std = 0;
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
Sleep(2000);
|
||||
EXPECT_EQ(0, voe_apm_->GetEchoMetrics(erl, erle, rerl, a_nlp));
|
||||
EXPECT_EQ(0, voe_apm_->GetEcDelayMetrics(delay_median, delay_std));
|
||||
TEST_LOG(" Echo : ERL=%5d, ERLE=%5d, RERL=%5d, A_NLP=%5d [dB], "
|
||||
" delay median=%3d, delay std=%3d [ms]\n", erl, erle, rerl, a_nlp,
|
||||
delay_median, delay_std);
|
||||
TEST_F(AudioProcessingTest, CanEnableAndDisableEcModeSeveralTimesInARow) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
EXPECT_EQ(0, voe_apm_->SetEcStatus(true));
|
||||
EXPECT_EQ(0, voe_apm_->SetEcStatus(false));
|
||||
}
|
||||
|
||||
EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(false));
|
||||
bool ec_enabled = true;
|
||||
webrtc::EcModes ec_mode = webrtc::kEcDefault;
|
||||
EXPECT_EQ(0, voe_apm_->GetEcStatus(ec_enabled, ec_mode));
|
||||
|
||||
EXPECT_FALSE(ec_enabled);
|
||||
EXPECT_EQ(webrtc::kEcAec, ec_mode);
|
||||
}
|
||||
|
||||
// TODO(phoglund): Reenable below test when it's no longer flaky.
|
||||
@ -371,6 +368,15 @@ TEST_F(AudioProcessingTest, CanSetStereoChannelSwapping) {
|
||||
EXPECT_FALSE(voe_apm_->IsStereoChannelSwappingEnabled());
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, CanStartAndStopDebugRecording) {
|
||||
std::string output_path = webrtc::test::OutputPath();
|
||||
std::string output_file = output_path + "apm_debug.txt";
|
||||
|
||||
EXPECT_EQ(0, voe_apm_->StartDebugRecording(output_file.c_str()));
|
||||
Sleep(1000);
|
||||
EXPECT_EQ(0, voe_apm_->StopDebugRecording());
|
||||
}
|
||||
|
||||
#if defined(MAC_IPHONE) || defined(WEBRTC_ANDROID)
|
||||
|
||||
TEST_F(AudioProcessingTest, AgcIsOffByDefaultAndDigital) {
|
||||
|
@ -333,7 +333,7 @@ int VoEExtendedTest::TestBase() {
|
||||
|
||||
PrepareTest("Base");
|
||||
|
||||
// TODO(qhogpat): make this an actual instance variable. I think the
|
||||
// TODO(phoglund): make this an actual instance variable. I think the
|
||||
// macro black magic will make more sense then. This is named like an
|
||||
// instance variable since it is required in order to appease the
|
||||
// gods of darkness.
|
||||
@ -7521,711 +7521,4 @@ int VoEExtendedTest::TestVolumeControl()
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// VoEExtendedTest::TestAPM
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int VoEExtendedTest::TestAPM() {
|
||||
PrepareTest("AudioProcessing");
|
||||
|
||||
VoEBase* voe_base_ = _mgr.BasePtr();
|
||||
VoEAudioProcessing* apm = _mgr.APMPtr();
|
||||
|
||||
//#ifdef _USE_EXTENDED_TRACE_
|
||||
std::string output_path = webrtc::test::OutputPath();
|
||||
TEST_MUSTPASS(VoiceEngine::SetTraceFile(
|
||||
(output_path + "apm_trace.txt").c_str()));
|
||||
TEST_MUSTPASS(VoiceEngine::SetTraceFilter(kTraceStateInfo |
|
||||
kTraceStateInfo |
|
||||
kTraceWarning |
|
||||
kTraceError |
|
||||
kTraceCritical |
|
||||
kTraceApiCall |
|
||||
kTraceMemory |
|
||||
kTraceInfo));
|
||||
//#endif
|
||||
|
||||
TEST_MUSTPASS(voe_base_->Init());
|
||||
TEST_MUSTPASS(voe_base_->CreateChannel());
|
||||
|
||||
///////////////////////////
|
||||
// Actual test starts here
|
||||
|
||||
int i;
|
||||
bool enabled;
|
||||
|
||||
//////
|
||||
// EC
|
||||
|
||||
const int ECSleep = 0;
|
||||
const int ECIterations = 10;
|
||||
|
||||
EcModes ECmode(kEcAec);
|
||||
AecmModes AECMmode(kAecmSpeakerphone);
|
||||
bool enabledCNG(false);
|
||||
|
||||
#if (defined(MAC_IPHONE) || defined(WEBRTC_ANDROID))
|
||||
const EcModes ECmodeDefault(kEcAecm);
|
||||
#else
|
||||
const EcModes ECmodeDefault(kEcAec);
|
||||
#endif
|
||||
|
||||
// verify default settings (should be OFF and mode as above)
|
||||
TEST_MUSTPASS(apm->GetEcStatus(enabled, ECmode));
|
||||
TEST_LOG("EC: enabled=%d, ECmode=%d\n", enabled, ECmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(ECmode != ECmodeDefault);
|
||||
|
||||
// set EC defaults
|
||||
TEST_MUSTPASS(apm->SetEcStatus(false, kEcDefault));
|
||||
TEST_MUSTPASS(apm->GetEcStatus(enabled, ECmode));
|
||||
TEST_LOG("EC: enabled=%d, ECmode=%d\n", enabled, ECmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(ECmode != ECmodeDefault);
|
||||
SLEEP(ECSleep);
|
||||
|
||||
#if (!defined(MAC_IPHONE) && !defined(WEBRTC_ANDROID))
|
||||
// set kEcAec mode
|
||||
TEST_MUSTPASS(apm->SetEcStatus(true, kEcAec));
|
||||
TEST_MUSTPASS(apm->GetEcStatus(enabled, ECmode));
|
||||
TEST_LOG("EC: enabled=%d, ECmode=%d\n", enabled, ECmode);
|
||||
TEST_MUSTPASS(enabled != true);
|
||||
TEST_MUSTPASS(ECmode != kEcAec);
|
||||
SLEEP(ECSleep);
|
||||
|
||||
// set kEcConference mode
|
||||
TEST_MUSTPASS(apm->SetEcStatus(true, kEcConference));
|
||||
TEST_MUSTPASS(apm->GetEcStatus(enabled, ECmode));
|
||||
TEST_LOG("EC: enabled=%d, ECmode=%d\n", enabled, ECmode);
|
||||
TEST_MUSTPASS(enabled != true);
|
||||
TEST_MUSTPASS(ECmode != kEcAec);
|
||||
SLEEP(ECSleep);
|
||||
#endif // #if (!defined(MAC_IPHONE) && !defined(WEBRTC_ANDROID))
|
||||
// get default AECM mode, should the kAecmSpeakerphone as default
|
||||
TEST_MUSTPASS(apm->GetAecmMode(AECMmode, enabledCNG));
|
||||
TEST_MUSTPASS(AECMmode != kAecmSpeakerphone);
|
||||
TEST_MUSTPASS(enabledCNG != true);
|
||||
TEST_MUSTPASS(apm->SetAecmMode(kAecmQuietEarpieceOrHeadset, false));
|
||||
TEST_MUSTPASS(apm->GetAecmMode(AECMmode, enabledCNG));
|
||||
TEST_LOG("AECM: mode=%d, CNG: mode=%d\n", AECMmode,
|
||||
enabledCNG);
|
||||
TEST_MUSTPASS(AECMmode != kAecmQuietEarpieceOrHeadset);
|
||||
TEST_MUSTPASS(enabledCNG != false);
|
||||
|
||||
// set kEcAecm mode
|
||||
TEST_MUSTPASS(apm->SetEcStatus(true, kEcAecm));
|
||||
TEST_MUSTPASS(apm->GetEcStatus(enabled, ECmode));
|
||||
TEST_LOG("EC: enabled=%d, ECmode=%d\n", enabled, ECmode);
|
||||
TEST_MUSTPASS(enabled != true);
|
||||
TEST_MUSTPASS(ECmode != kEcAecm);
|
||||
SLEEP(ECSleep);
|
||||
|
||||
// AECM mode, get and set
|
||||
TEST_MUSTPASS(apm->GetAecmMode(AECMmode, enabledCNG));
|
||||
TEST_MUSTPASS(AECMmode != kAecmQuietEarpieceOrHeadset);
|
||||
TEST_MUSTPASS(enabledCNG != false);
|
||||
TEST_MUSTPASS(apm->SetAecmMode(kAecmEarpiece, true));
|
||||
TEST_MUSTPASS(apm->GetAecmMode(AECMmode, enabledCNG));
|
||||
TEST_LOG("AECM: mode=%d, CNG: mode=%d\n", AECMmode,
|
||||
enabledCNG);
|
||||
TEST_MUSTPASS(AECMmode != kAecmEarpiece);
|
||||
TEST_MUSTPASS(enabledCNG != true);
|
||||
TEST_MUSTPASS(apm->SetAecmMode(kAecmEarpiece, false));
|
||||
TEST_MUSTPASS(apm->GetAecmMode(AECMmode, enabledCNG));
|
||||
TEST_LOG("AECM: mode=%d, CNG: mode=%d\n", AECMmode,
|
||||
enabledCNG);
|
||||
TEST_MUSTPASS(AECMmode != kAecmEarpiece);
|
||||
TEST_MUSTPASS(enabledCNG != false);
|
||||
TEST_MUSTPASS(apm->SetAecmMode(kAecmLoudEarpiece, true));
|
||||
TEST_MUSTPASS(apm->GetAecmMode(AECMmode, enabledCNG));
|
||||
TEST_LOG("AECM: mode=%d, CNG: mode=%d\n", AECMmode,
|
||||
enabledCNG);
|
||||
TEST_MUSTPASS(AECMmode != kAecmLoudEarpiece);
|
||||
TEST_MUSTPASS(enabledCNG != true);
|
||||
TEST_MUSTPASS(apm->SetAecmMode(kAecmSpeakerphone, false));
|
||||
TEST_MUSTPASS(apm->GetAecmMode(AECMmode, enabledCNG));
|
||||
TEST_LOG("AECM: mode=%d, CNG: mode=%d\n", AECMmode,
|
||||
enabledCNG);
|
||||
TEST_MUSTPASS(AECMmode != kAecmSpeakerphone);
|
||||
TEST_MUSTPASS(enabledCNG != false);
|
||||
TEST_MUSTPASS(apm->SetAecmMode(kAecmLoudSpeakerphone, true));
|
||||
TEST_MUSTPASS(apm->GetAecmMode(AECMmode, enabledCNG));
|
||||
TEST_LOG("AECM: mode=%d, CNG: mode=%d\n", AECMmode,
|
||||
enabledCNG);
|
||||
TEST_MUSTPASS(AECMmode != kAecmLoudSpeakerphone);
|
||||
TEST_MUSTPASS(enabledCNG != true);
|
||||
|
||||
// verify that all modes are maintained when EC is disabled
|
||||
TEST_MUSTPASS(apm->SetEcStatus(false));
|
||||
TEST_MUSTPASS(apm->GetEcStatus(enabled, ECmode));
|
||||
TEST_LOG("EC: enabled=%d, ECmode=%d\n", enabled, ECmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(ECmode != kEcAecm);
|
||||
SLEEP(ECSleep);
|
||||
|
||||
// restore defaults
|
||||
TEST_MUSTPASS(apm->SetEcStatus(true, kEcDefault));
|
||||
TEST_MUSTPASS(apm->SetEcStatus(false, kEcUnchanged));
|
||||
TEST_MUSTPASS(apm->GetEcStatus(enabled, ECmode));
|
||||
TEST_LOG("EC: enabled=%d, ECmode=%d\n", enabled, ECmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(ECmode != ECmodeDefault);
|
||||
SLEEP(ECSleep);
|
||||
|
||||
// enable/disable many times in a row
|
||||
for (i = 0; i < ECIterations; i++) {
|
||||
TEST_MUSTPASS(apm->SetEcStatus(true));
|
||||
TEST_MUSTPASS(apm->SetEcStatus(false));
|
||||
}
|
||||
TEST_MUSTPASS(apm->GetEcStatus(enabled, ECmode));
|
||||
TEST_LOG("EC: enabled=%d, ECmode=%d\n", enabled, ECmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(ECmode != ECmodeDefault);
|
||||
SLEEP(ECSleep);
|
||||
|
||||
///////
|
||||
// AGC
|
||||
|
||||
const int AGCSleep = 0;
|
||||
const int AGCIterations = 10;
|
||||
|
||||
AgcModes AGCmode(kAgcAdaptiveAnalog);
|
||||
|
||||
#if (defined(MAC_IPHONE) || defined(WEBRTC_ANDROID))
|
||||
bool enabledDefault = false;
|
||||
AgcModes AGCmodeDefault(kAgcAdaptiveDigital);
|
||||
#else
|
||||
bool enabledDefault = true;
|
||||
AgcModes AGCmodeDefault(kAgcAdaptiveAnalog);
|
||||
#endif
|
||||
|
||||
// verify default settings (should be as above)
|
||||
TEST_MUSTPASS(apm->GetAgcStatus(enabled, AGCmode));
|
||||
TEST_LOG("AGC: enabled=%d, AGCmode=%d\n", enabled, AGCmode);
|
||||
TEST_MUSTPASS(enabled != enabledDefault);
|
||||
TEST_MUSTPASS(AGCmode != AGCmodeDefault);
|
||||
|
||||
// set default AGC mode
|
||||
TEST_MUSTPASS(apm->SetAgcStatus(false, kAgcDefault));
|
||||
TEST_MUSTPASS(apm->GetAgcStatus(enabled, AGCmode));
|
||||
TEST_LOG("AGC: enabled=%d, AGCmode=%d\n", enabled, AGCmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(AGCmode != AGCmodeDefault);
|
||||
SLEEP(AGCSleep);
|
||||
|
||||
// set kAgcFixedDigital mode
|
||||
TEST_MUSTPASS(apm->SetAgcStatus(true, kAgcFixedDigital));
|
||||
TEST_MUSTPASS(apm->GetAgcStatus(enabled, AGCmode));
|
||||
TEST_LOG("AGC: enabled=%d, AGCmode=%d\n", enabled, AGCmode);
|
||||
TEST_MUSTPASS(AGCmode != kAgcFixedDigital);
|
||||
SLEEP(AGCSleep);
|
||||
|
||||
#if (!defined(MAC_IPHONE) && !defined(WEBRTC_ANDROID))
|
||||
// set kAgcAdaptiveAnalog mode
|
||||
TEST_MUSTPASS(apm->SetAgcStatus(true, kAgcAdaptiveAnalog));
|
||||
TEST_MUSTPASS(apm->GetAgcStatus(enabled, AGCmode));
|
||||
TEST_LOG("AGC: enabled=%d, AGCmode=%d\n", enabled, AGCmode);
|
||||
TEST_MUSTPASS(AGCmode != kAgcAdaptiveAnalog);
|
||||
SLEEP(AGCSleep);
|
||||
#endif // #if (!defined(MAC_IPHONE) && !defined(WEBRTC_ANDROID))
|
||||
// set kAgcAdaptiveDigital mode
|
||||
TEST_MUSTPASS(apm->SetAgcStatus(true, kAgcAdaptiveDigital));
|
||||
TEST_MUSTPASS(apm->GetAgcStatus(enabled, AGCmode));
|
||||
TEST_LOG("AGC: enabled=%d, AGCmode=%d\n", enabled, AGCmode);
|
||||
TEST_MUSTPASS(AGCmode != kAgcAdaptiveDigital);
|
||||
SLEEP(AGCSleep);
|
||||
|
||||
// verify that mode is maintained when AGC is disabled
|
||||
TEST_MUSTPASS(apm->SetAgcStatus(false));
|
||||
TEST_MUSTPASS(apm->GetAgcStatus(enabled, AGCmode));
|
||||
TEST_LOG("AGC: enabled=%d, AGCmode=%d\n", enabled, AGCmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(AGCmode != kAgcAdaptiveDigital);
|
||||
SLEEP(AGCSleep);
|
||||
|
||||
// restore default AGC
|
||||
TEST_MUSTPASS(apm->SetAgcStatus(enabledDefault, kAgcDefault));
|
||||
TEST_MUSTPASS(apm->GetAgcStatus(enabled, AGCmode));
|
||||
TEST_LOG("AGC: enabled=%d, AGCmode=%d\n", enabled, AGCmode);
|
||||
TEST_MUSTPASS(enabled != enabledDefault);
|
||||
TEST_MUSTPASS(AGCmode != AGCmodeDefault);
|
||||
SLEEP(AGCSleep);
|
||||
|
||||
// enable/disable many times in a row
|
||||
for (i = 0; i < AGCIterations; i++)
|
||||
{
|
||||
TEST_MUSTPASS(apm->SetAgcStatus(true));
|
||||
TEST_MUSTPASS(apm->SetAgcStatus(false));
|
||||
}
|
||||
TEST_MUSTPASS(apm->GetAgcStatus(enabled, AGCmode));
|
||||
TEST_LOG("AGC: enabled=%d, AGCmode=%d\n", enabled, AGCmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(AGCmode != AGCmodeDefault);
|
||||
|
||||
// --- Set/AGCConfig --
|
||||
|
||||
//
|
||||
// targetLeveldBOv : [0, 31] (default 3)
|
||||
// digitalCompressionGaindB: [0, 90] (default 9)
|
||||
// limiterEnable : 0: Off, 1: On (default)
|
||||
|
||||
AgcConfig agcConfig;
|
||||
AgcConfig agcConfigDefault;
|
||||
|
||||
const unsigned short targetLeveldBOvDefault = 3;
|
||||
const unsigned short digitalCompressionGaindBDefault = 9;
|
||||
const bool limiterEnableDefault = true;
|
||||
|
||||
const unsigned short targetLeveldBOvMax = 31;
|
||||
const unsigned short digitalCompressionGaindBMax = 90;
|
||||
|
||||
// verify default configuration
|
||||
TEST_MUSTPASS(apm->GetAgcConfig(agcConfigDefault));
|
||||
TEST_LOG("AGC: targetLeveldBOv=%d, digitalCompressionGaindB=%d, "
|
||||
"limiterEnable=%d\n",
|
||||
agcConfigDefault.targetLeveldBOv,
|
||||
agcConfigDefault.digitalCompressionGaindB,
|
||||
agcConfigDefault.limiterEnable);
|
||||
TEST_MUSTPASS(agcConfigDefault.targetLeveldBOv != targetLeveldBOvDefault);
|
||||
TEST_MUSTPASS(agcConfigDefault.digitalCompressionGaindB !=
|
||||
digitalCompressionGaindBDefault);
|
||||
TEST_MUSTPASS(agcConfigDefault.limiterEnable != limiterEnableDefault);
|
||||
|
||||
// verify that invalid (out-of-range) parameters are detected
|
||||
agcConfig = agcConfigDefault;
|
||||
agcConfig.targetLeveldBOv = targetLeveldBOvMax + 1;
|
||||
TEST_MUSTPASS(!apm->SetAgcConfig(agcConfig));
|
||||
int err = voe_base_->LastError();
|
||||
TEST_MUSTPASS(err != VE_APM_ERROR);
|
||||
agcConfig = agcConfigDefault;
|
||||
agcConfig.digitalCompressionGaindB
|
||||
= digitalCompressionGaindBMax + 1;
|
||||
TEST_MUSTPASS(!apm->SetAgcConfig(agcConfig));
|
||||
|
||||
AgcConfig agcConfigSet;
|
||||
agcConfigSet.digitalCompressionGaindB = 17;
|
||||
agcConfigSet.targetLeveldBOv = 11;
|
||||
agcConfigSet.limiterEnable = false;
|
||||
|
||||
// try some set/get operations using valid settings
|
||||
TEST_MUSTPASS(apm->SetAgcConfig(agcConfigDefault));
|
||||
TEST_MUSTPASS(apm->GetAgcConfig(agcConfig));
|
||||
TEST_MUSTPASS(agcConfig.targetLeveldBOv != targetLeveldBOvDefault);
|
||||
TEST_MUSTPASS(agcConfig.digitalCompressionGaindB !=
|
||||
digitalCompressionGaindBDefault);
|
||||
TEST_MUSTPASS(agcConfig.limiterEnable != limiterEnableDefault);
|
||||
|
||||
TEST_MUSTPASS(apm->SetAgcConfig(agcConfigSet));
|
||||
TEST_MUSTPASS(apm->GetAgcConfig(agcConfig));
|
||||
TEST_MUSTPASS(agcConfig.targetLeveldBOv != agcConfigSet.targetLeveldBOv);
|
||||
TEST_MUSTPASS(agcConfig.digitalCompressionGaindB !=
|
||||
agcConfigSet.digitalCompressionGaindB);
|
||||
TEST_MUSTPASS(agcConfig.limiterEnable != agcConfigSet.limiterEnable);
|
||||
|
||||
// restore default AGC config
|
||||
TEST_MUSTPASS(apm->SetAgcConfig(agcConfigDefault));
|
||||
SLEEP(AGCSleep);
|
||||
|
||||
//////
|
||||
// NS
|
||||
|
||||
const int NSSleep = 0;
|
||||
const int NSIterations = 10;
|
||||
|
||||
NsModes NSmode(kNsHighSuppression);
|
||||
NsModes NSmodeDefault(kNsModerateSuppression);
|
||||
|
||||
// verify default settings (should be OFF and mode as above)
|
||||
TEST_MUSTPASS(apm->GetNsStatus(enabled, NSmode));
|
||||
TEST_LOG("NS: enabled=%d, NSmode=%d\n", enabled, NSmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(NSmode != NSmodeDefault);
|
||||
|
||||
// enable default NS settings
|
||||
// must set a value first time!
|
||||
TEST_MUSTPASS(apm->SetNsStatus(false, kNsDefault));
|
||||
TEST_MUSTPASS(apm->GetNsStatus(enabled, NSmode));
|
||||
TEST_LOG("NS: enabled=%d, NSmode=%d\n", enabled, NSmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(NSmode != NSmodeDefault);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
// set kNsLowSuppression mode
|
||||
TEST_MUSTPASS(apm->SetNsStatus(true, kNsLowSuppression));
|
||||
TEST_MUSTPASS(apm->GetNsStatus(enabled, NSmode));
|
||||
TEST_LOG("NS: enabled=%d, NSmode=%d\n", enabled, NSmode);
|
||||
TEST_MUSTPASS(NSmode != kNsLowSuppression);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
// set kNsModerateSuppression mode
|
||||
TEST_MUSTPASS(apm->SetNsStatus(true, kNsModerateSuppression));
|
||||
TEST_MUSTPASS(apm->GetNsStatus(enabled, NSmode));
|
||||
TEST_LOG("NS: enabled=%d, NSmode=%d\n", enabled, NSmode);
|
||||
TEST_MUSTPASS(NSmode != kNsModerateSuppression);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
// set kNsHighSuppression mode
|
||||
TEST_MUSTPASS(apm->SetNsStatus(true, kNsHighSuppression));
|
||||
TEST_MUSTPASS(apm->GetNsStatus(enabled, NSmode));
|
||||
TEST_LOG("NS: enabled=%d, NSmode=%d\n", enabled, NSmode);
|
||||
TEST_MUSTPASS(NSmode != kNsHighSuppression);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
// set kNsVeryHighSuppression mode
|
||||
TEST_MUSTPASS(apm->SetNsStatus(true, kNsVeryHighSuppression));
|
||||
TEST_MUSTPASS(apm->GetNsStatus(enabled, NSmode));
|
||||
TEST_LOG("NS: enabled=%d, NSmode=%d\n", enabled, NSmode);
|
||||
TEST_MUSTPASS(NSmode != kNsVeryHighSuppression);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
// set kNsVeryHighSuppression mode
|
||||
TEST_MUSTPASS(apm->SetNsStatus(true, kNsConference));
|
||||
TEST_MUSTPASS(apm->GetNsStatus(enabled, NSmode));
|
||||
TEST_LOG("NS: enabled=%d, NSmode=%d\n", enabled, NSmode);
|
||||
TEST_MUSTPASS(NSmode != kNsHighSuppression);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
// verify that mode is maintained when NS is disabled
|
||||
TEST_MUSTPASS(apm->SetNsStatus(false));
|
||||
TEST_MUSTPASS(apm->GetNsStatus(enabled, NSmode));
|
||||
TEST_LOG("NS: enabled=%d, NSmode=%d\n", enabled, NSmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(NSmode != kNsHighSuppression);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
// restore default NS
|
||||
TEST_MUSTPASS(apm->SetNsStatus(true, kNsDefault));
|
||||
TEST_MUSTPASS(apm->SetNsStatus(false));
|
||||
TEST_MUSTPASS(apm->GetNsStatus(enabled, NSmode));
|
||||
TEST_LOG("NS: enabled=%d, NSmode=%d\n", enabled, NSmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(NSmode != NSmodeDefault);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
// enable/disable many times in a row
|
||||
for (i = 0; i < NSIterations; i++) {
|
||||
TEST_MUSTPASS(apm->SetNsStatus(true));
|
||||
TEST_MUSTPASS(apm->SetNsStatus(false));
|
||||
}
|
||||
TEST_MUSTPASS(apm->GetNsStatus(enabled, NSmode));
|
||||
TEST_LOG("NS: enabled=%d, NSmode=%d\n", enabled, NSmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(NSmode != NSmodeDefault);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
//////////////////////////////////
|
||||
// Ec Metrics
|
||||
|
||||
#if (!defined(MAC_IPHONE) && !defined(WEBRTC_ANDROID))
|
||||
TEST(GetEcMetricsStatus);
|
||||
ANL();
|
||||
TEST(SetEcMetricsStatus);
|
||||
ANL();
|
||||
TEST_MUSTPASS(apm->GetEcMetricsStatus(enabled));
|
||||
MARK();
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
MARK(); // should be OFF by default
|
||||
TEST_MUSTPASS(apm->SetEcMetricsStatus(true));
|
||||
MARK();
|
||||
TEST_MUSTPASS(apm->GetEcMetricsStatus(enabled));
|
||||
MARK();
|
||||
TEST_MUSTPASS(enabled != true);
|
||||
MARK();
|
||||
TEST_MUSTPASS(apm->SetEcMetricsStatus(false));
|
||||
MARK();
|
||||
TEST_MUSTPASS(apm->GetEcMetricsStatus(enabled));
|
||||
MARK();
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
MARK();
|
||||
AOK();
|
||||
ANL();
|
||||
|
||||
TEST(GetEchoMetrics);
|
||||
ANL();
|
||||
|
||||
int ERL, ERLE, RERL, A_NLP;
|
||||
TEST_MUSTPASS(-1 != apm->GetEchoMetrics(ERL, ERLE, RERL, A_NLP));
|
||||
MARK(); // Should fail since not activated.
|
||||
err = voe_base_->LastError();
|
||||
TEST_MUSTPASS(err != VE_APM_ERROR);
|
||||
TEST_MUSTPASS(apm->SetEcMetricsStatus(true));
|
||||
TEST_MUSTPASS(-1 != apm->GetEchoMetrics(ERL, ERLE, RERL, A_NLP));
|
||||
MARK(); // Should fail since AEC is off.
|
||||
err = voe_base_->LastError();
|
||||
TEST_MUSTPASS(err != VE_APM_ERROR);
|
||||
TEST_MUSTPASS(apm->SetEcStatus(true));
|
||||
TEST_MUSTPASS(apm->GetEchoMetrics(ERL, ERLE, RERL, A_NLP));
|
||||
MARK(); // Should work now.
|
||||
TEST_LOG("\nEcho: ERL=%d, ERLE=%d, RERL=%d, A_NLP=%d [dB]\n",
|
||||
ERL, ERLE, RERL, A_NLP);
|
||||
TEST_MUSTPASS(apm->SetEcMetricsStatus(false));
|
||||
TEST_MUSTPASS(apm->SetEcStatus(false));
|
||||
AOK();
|
||||
ANL();
|
||||
|
||||
TEST(GetEcDelayMetrics);
|
||||
ANL();
|
||||
|
||||
int delay_median = 0;
|
||||
int delay_std = 0;
|
||||
TEST_MUSTPASS(-1 != apm->GetEcDelayMetrics(delay_median, delay_std));
|
||||
MARK(); // Should fail since not activated.
|
||||
err = voe_base_->LastError();
|
||||
TEST_MUSTPASS(err != VE_APM_ERROR);
|
||||
TEST_MUSTPASS(apm->SetEcMetricsStatus(true));
|
||||
TEST_MUSTPASS(-1 != apm->GetEcDelayMetrics(delay_median, delay_std));
|
||||
MARK(); // Should fail since AEC is off.
|
||||
err = voe_base_->LastError();
|
||||
TEST_MUSTPASS(err != VE_APM_ERROR);
|
||||
TEST_MUSTPASS(apm->SetEcStatus(true));
|
||||
TEST_MUSTPASS(apm->GetEcDelayMetrics(delay_median, delay_std));
|
||||
MARK(); // Should work now.
|
||||
TEST_LOG("\nEC Delay: median=%d, std=%d [ms]\n", delay_median, delay_std);
|
||||
TEST_MUSTPASS(apm->SetEcMetricsStatus(false));
|
||||
TEST_MUSTPASS(apm->SetEcStatus(false));
|
||||
AOK();
|
||||
ANL();
|
||||
|
||||
#endif // #if (!defined(MAC_IPHONE) && !defined(WEBRTC_ANDROID))
|
||||
// far-end AudioProcessing
|
||||
///////
|
||||
// AGC
|
||||
|
||||
AgcModes rxAGCmode(kAgcAdaptiveDigital);
|
||||
AgcModes rxAGCmodeDefault(kAgcAdaptiveDigital);
|
||||
bool rxEnabledDefault = false;
|
||||
|
||||
// verify default settings (should be as above)
|
||||
TEST_MUSTPASS(apm->GetRxAgcStatus(0, enabled, rxAGCmode));
|
||||
TEST_LOG("rxAGC: enabled=%d, AGCmode=%d\n", enabled,
|
||||
rxAGCmode);
|
||||
TEST_MUSTPASS(enabled != rxEnabledDefault);
|
||||
TEST_MUSTPASS(rxAGCmode != rxAGCmodeDefault);
|
||||
|
||||
// set default AGC mode
|
||||
TEST_MUSTPASS(apm->SetRxAgcStatus(0, false, kAgcDefault));
|
||||
TEST_MUSTPASS(apm->GetRxAgcStatus(0, enabled, rxAGCmode));
|
||||
TEST_LOG("rxAGC: enabled=%d, AGCmode=%d\n", enabled,
|
||||
rxAGCmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(rxAGCmode != rxAGCmodeDefault);
|
||||
SLEEP(AGCSleep);
|
||||
|
||||
// set kAgcAdaptiveAnalog mode, should fail
|
||||
TEST_MUSTPASS(!apm->SetRxAgcStatus(0, true, kAgcAdaptiveAnalog));
|
||||
|
||||
// set kAgcFixedDigital mode
|
||||
TEST_MUSTPASS(apm->SetRxAgcStatus(0, true, kAgcFixedDigital));
|
||||
TEST_MUSTPASS(apm->GetRxAgcStatus(0, enabled, rxAGCmode));
|
||||
TEST_LOG("rxAGC: enabled=%d, AGCmode=%d\n", enabled,
|
||||
rxAGCmode);
|
||||
TEST_MUSTPASS(rxAGCmode != kAgcFixedDigital);
|
||||
SLEEP(AGCSleep);
|
||||
|
||||
// set kAgcAdaptiveDigital mode
|
||||
TEST_MUSTPASS(apm->SetRxAgcStatus(0, true, kAgcAdaptiveDigital));
|
||||
TEST_MUSTPASS(apm->GetRxAgcStatus(0, enabled, rxAGCmode));
|
||||
TEST_LOG("rxAGC: enabled=%d, AGCmode=%d\n", enabled,
|
||||
rxAGCmode);
|
||||
TEST_MUSTPASS(rxAGCmode != kAgcAdaptiveDigital);
|
||||
SLEEP(AGCSleep);
|
||||
|
||||
// verify that mode is maintained when AGC is disabled
|
||||
TEST_MUSTPASS(apm->SetRxAgcStatus(0, false));
|
||||
TEST_MUSTPASS(apm->GetRxAgcStatus(0, enabled, rxAGCmode));
|
||||
TEST_LOG("rxAGC: enabled=%d, AGCmode=%d\n", enabled,
|
||||
rxAGCmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(rxAGCmode != kAgcAdaptiveDigital);
|
||||
SLEEP(AGCSleep);
|
||||
|
||||
// restore default AGC
|
||||
TEST_MUSTPASS(apm->SetRxAgcStatus(0, enabledDefault, kAgcDefault));
|
||||
TEST_MUSTPASS(apm->GetRxAgcStatus(0, enabled, rxAGCmode));
|
||||
TEST_LOG("rxAGC: enabled=%d, AGCmode=%d\n", enabled,
|
||||
rxAGCmode);
|
||||
TEST_MUSTPASS(enabled != enabledDefault);
|
||||
TEST_MUSTPASS(rxAGCmode != rxAGCmodeDefault);
|
||||
SLEEP(AGCSleep);
|
||||
|
||||
// enable/disable many times in a row
|
||||
for (i = 0; i < AGCIterations; i++) {
|
||||
TEST_MUSTPASS(apm->SetRxAgcStatus(0, true));
|
||||
TEST_MUSTPASS(apm->SetRxAgcStatus(0, false));
|
||||
}
|
||||
TEST_MUSTPASS(apm->GetRxAgcStatus(0, enabled, rxAGCmode));
|
||||
TEST_LOG("rxAGC: enabled=%d, AGCmode=%d\n", enabled,
|
||||
rxAGCmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(rxAGCmode != rxAGCmodeDefault);
|
||||
|
||||
// --- Set/GetAgcConfig --
|
||||
|
||||
|
||||
// targetLeveldBOv : [0, 31] (default 3)
|
||||
// digitalCompressionGaindB: [0, 90] (default 9)
|
||||
// limiterEnable : 0: Off, 1: On (default)
|
||||
|
||||
AgcConfig rxAGCConfig;
|
||||
AgcConfig rxAGCConfigDefault;
|
||||
|
||||
const unsigned short rxTargetLeveldBOvDefault = 3;
|
||||
const unsigned short rxDigitalCompressionGaindBDefault = 9;
|
||||
const bool rxLimiterEnableDefault = true;
|
||||
|
||||
const unsigned short rxTargetLeveldBOvMax = 31;
|
||||
const unsigned short rxDigitalCompressionGaindBMax = 90;
|
||||
|
||||
// verify default configuration
|
||||
TEST_MUSTPASS(apm->GetRxAgcConfig(0, rxAGCConfigDefault));
|
||||
TEST_LOG(
|
||||
"rxAGC: targetLeveldBOv=%u, digitalCompressionGaindB=%u, "
|
||||
"limiterEnable=%d\n",
|
||||
rxAGCConfigDefault.targetLeveldBOv,
|
||||
rxAGCConfigDefault.digitalCompressionGaindB,
|
||||
rxAGCConfigDefault.limiterEnable);
|
||||
TEST_MUSTPASS(rxAGCConfigDefault.targetLeveldBOv !=
|
||||
rxTargetLeveldBOvDefault);
|
||||
TEST_MUSTPASS(rxAGCConfigDefault.digitalCompressionGaindB !=
|
||||
rxDigitalCompressionGaindBDefault);
|
||||
TEST_MUSTPASS(rxAGCConfigDefault.limiterEnable != rxLimiterEnableDefault);
|
||||
|
||||
// verify that invalid (out-of-range) parameters are detected
|
||||
rxAGCConfig = rxAGCConfigDefault;
|
||||
rxAGCConfig.targetLeveldBOv = rxTargetLeveldBOvMax + 1;
|
||||
TEST_MUSTPASS(!apm->SetRxAgcConfig(0, rxAGCConfig));
|
||||
int rxErr = voe_base_->LastError();
|
||||
TEST_MUSTPASS(rxErr != VE_APM_ERROR);
|
||||
rxAGCConfig = rxAGCConfigDefault;
|
||||
rxAGCConfig.digitalCompressionGaindB
|
||||
= rxDigitalCompressionGaindBMax + 1;
|
||||
TEST_MUSTPASS(!apm->SetRxAgcConfig(0, rxAGCConfig));
|
||||
|
||||
AgcConfig rxAGCConfigSet;
|
||||
rxAGCConfigSet.digitalCompressionGaindB = 17;
|
||||
rxAGCConfigSet.targetLeveldBOv = 11;
|
||||
rxAGCConfigSet.limiterEnable = false;
|
||||
|
||||
// try some set/get operations using valid settings
|
||||
TEST_MUSTPASS(apm->SetRxAgcConfig(0, rxAGCConfigDefault));
|
||||
TEST_MUSTPASS(apm->GetRxAgcConfig(0, rxAGCConfig));
|
||||
TEST_MUSTPASS(rxAGCConfig.targetLeveldBOv != rxTargetLeveldBOvDefault);
|
||||
TEST_MUSTPASS(rxAGCConfig.digitalCompressionGaindB !=
|
||||
rxDigitalCompressionGaindBDefault);
|
||||
TEST_MUSTPASS(rxAGCConfig.limiterEnable != rxLimiterEnableDefault);
|
||||
|
||||
TEST_MUSTPASS(apm->SetRxAgcConfig(0, rxAGCConfigSet));
|
||||
TEST_MUSTPASS(apm->GetRxAgcConfig(0, rxAGCConfig));
|
||||
TEST_MUSTPASS(rxAGCConfig.targetLeveldBOv !=
|
||||
rxAGCConfigSet.targetLeveldBOv);
|
||||
TEST_MUSTPASS(rxAGCConfig.digitalCompressionGaindB !=
|
||||
rxAGCConfigSet.digitalCompressionGaindB);
|
||||
TEST_MUSTPASS(rxAGCConfig.limiterEnable != rxAGCConfigSet.limiterEnable);
|
||||
|
||||
// restore default AGC config
|
||||
TEST_MUSTPASS(apm->SetRxAgcConfig(0, rxAGCConfigDefault));
|
||||
SLEEP(AGCSleep);
|
||||
|
||||
//////
|
||||
// NS
|
||||
|
||||
NsModes rxNSmode(kNsHighSuppression);
|
||||
NsModes rxNSmodeDefault(kNsModerateSuppression);
|
||||
|
||||
// verify default settings (should be OFF and mode as above)
|
||||
TEST_MUSTPASS(apm->GetRxNsStatus(0, enabled, rxNSmode));
|
||||
TEST_LOG("rxNS: enabled=%d, NSmode=%d\n", enabled, rxNSmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(rxNSmode != rxNSmodeDefault);
|
||||
|
||||
// enable default NS settings
|
||||
// must set a value first time!
|
||||
TEST_MUSTPASS(apm->SetRxNsStatus(0, false, kNsDefault));
|
||||
TEST_MUSTPASS(apm->GetRxNsStatus(0, enabled, rxNSmode));
|
||||
TEST_LOG("rxNS: enabled=%d, NSmode=%d\n", enabled, rxNSmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(rxNSmode != rxNSmodeDefault);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
// set kNsLowSuppression mode
|
||||
TEST_MUSTPASS(apm->SetRxNsStatus(0, true, kNsLowSuppression));
|
||||
TEST_MUSTPASS(apm->GetRxNsStatus(0, enabled, rxNSmode));
|
||||
TEST_LOG("rxNS: enabled=%d, NSmode=%d\n", enabled, rxNSmode);
|
||||
TEST_MUSTPASS(rxNSmode != kNsLowSuppression);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
// set kNsModerateSuppression mode
|
||||
TEST_MUSTPASS(apm->SetRxNsStatus(0, true, kNsModerateSuppression));
|
||||
TEST_MUSTPASS(apm->GetRxNsStatus(0, enabled, rxNSmode));
|
||||
TEST_LOG("rxNS: enabled=%d, NSmode=%d\n", enabled, rxNSmode);
|
||||
TEST_MUSTPASS(rxNSmode != kNsModerateSuppression);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
// set kNsHighSuppression mode
|
||||
TEST_MUSTPASS(apm->SetRxNsStatus(0, true, kNsHighSuppression));
|
||||
TEST_MUSTPASS(apm->GetRxNsStatus(0, enabled, rxNSmode));
|
||||
TEST_LOG("rxNS: enabled=%d, NSmode=%d\n", enabled, rxNSmode);
|
||||
TEST_MUSTPASS(rxNSmode != kNsHighSuppression);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
// set kNsVeryHighSuppression mode
|
||||
TEST_MUSTPASS(apm->SetRxNsStatus(0, true, kNsVeryHighSuppression));
|
||||
TEST_MUSTPASS(apm->GetRxNsStatus(0, enabled, rxNSmode));
|
||||
TEST_LOG("rxNS: enabled=%d, NSmode=%d\n", enabled, rxNSmode);
|
||||
TEST_MUSTPASS(rxNSmode != kNsVeryHighSuppression);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
// set kNsVeryHighSuppression mode
|
||||
TEST_MUSTPASS(apm->SetRxNsStatus(0, true, kNsConference));
|
||||
TEST_MUSTPASS(apm->GetRxNsStatus(0, enabled, rxNSmode));
|
||||
TEST_LOG("rxNS: enabled=%d, NSmode=%d\n", enabled, rxNSmode);
|
||||
TEST_MUSTPASS(rxNSmode != kNsHighSuppression);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
// verify that mode is maintained when NS is disabled
|
||||
TEST_MUSTPASS(apm->SetRxNsStatus(0, false));
|
||||
TEST_MUSTPASS(apm->GetRxNsStatus(0, enabled, rxNSmode));
|
||||
TEST_LOG("rxNS: enabled=%d, NSmode=%d\n", enabled, rxNSmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(rxNSmode != kNsHighSuppression);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
// restore default NS
|
||||
TEST_MUSTPASS(apm->SetRxNsStatus(0, true, kNsDefault));
|
||||
TEST_MUSTPASS(apm->SetRxNsStatus(0, false));
|
||||
TEST_MUSTPASS(apm->GetRxNsStatus(0, enabled, rxNSmode));
|
||||
TEST_LOG("rxNS: enabled=%d, NSmode=%d\n", enabled, rxNSmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(rxNSmode != NSmodeDefault);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
// enable/disable many times in a row
|
||||
for (i = 0; i < NSIterations; i++)
|
||||
{
|
||||
TEST_MUSTPASS(apm->SetRxNsStatus(0, true));
|
||||
TEST_MUSTPASS(apm->SetRxNsStatus(0, false));
|
||||
}
|
||||
TEST_MUSTPASS(apm->GetRxNsStatus(0, enabled, rxNSmode));
|
||||
TEST_LOG("rxNS: enabled=%d, NSmode=%d\n", enabled, rxNSmode);
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(rxNSmode != NSmodeDefault);
|
||||
SLEEP(NSSleep);
|
||||
|
||||
/////////////////////////////
|
||||
// StartDebugRecording
|
||||
////////////////////////////
|
||||
// StopDebugRecording
|
||||
TEST_LOG("StartDebugRecording");
|
||||
TEST_MUSTPASS(apm->StartDebugRecording(
|
||||
(output_path + "apm_debug.txt").c_str()));
|
||||
SLEEP(1000);
|
||||
TEST_LOG("StopDebugRecording");
|
||||
TEST_MUSTPASS(apm->StopDebugRecording());
|
||||
|
||||
TEST_MUSTPASS(voe_base_->DeleteChannel(0));
|
||||
TEST_MUSTPASS(voe_base_->Terminate());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace voetest
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 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
|
||||
@ -425,7 +425,6 @@ class VoEExtendedTest : public VoiceEngineObserver,
|
||||
int TestRTP_RTCP();
|
||||
int TestVideoSync();
|
||||
int TestVolumeControl();
|
||||
int TestAPM();
|
||||
public:
|
||||
int ErrorCode() const {
|
||||
return _errCode;
|
||||
|
@ -179,11 +179,6 @@ bool SubAPIManager::GetExtendedMenuSelection(ExtendedSelection& sel) {
|
||||
printf("\n");
|
||||
else
|
||||
printf(" (NA)\n");
|
||||
printf(" (14) AudioProcessing");
|
||||
if (_apm)
|
||||
printf("\n");
|
||||
else
|
||||
printf(" (NA)\n");
|
||||
printf("\n: ");
|
||||
|
||||
ExtendedSelection xsel(XSEL_Invalid);
|
||||
@ -246,10 +241,6 @@ bool SubAPIManager::GetExtendedMenuSelection(ExtendedSelection& sel) {
|
||||
if (_volumeControl)
|
||||
xsel = XSEL_VolumeControl;
|
||||
break;
|
||||
case 14:
|
||||
if (_apm)
|
||||
xsel = XSEL_AudioProcessing;
|
||||
break;
|
||||
default:
|
||||
xsel = XSEL_Invalid;
|
||||
break;
|
||||
@ -513,11 +504,6 @@ int run_auto_test(TestType test_type, ExtendedSelection ext_selection) {
|
||||
break;
|
||||
xtend.TestPassed("VolumeControl");
|
||||
}
|
||||
if (ext_selection == XSEL_AudioProcessing || ext_selection == XSEL_All) {
|
||||
if ((result = xtend.TestAPM()) == -1)
|
||||
break;
|
||||
xtend.TestPassed("AudioProcessing");
|
||||
}
|
||||
api_manager.GetExtendedMenuSelection(ext_selection);
|
||||
} // while (extendedSel != XSEL_None)
|
||||
} else if (test_type == Stress) {
|
||||
|
@ -44,7 +44,6 @@ enum ExtendedSelection {
|
||||
XSEL_RTP_RTCP,
|
||||
XSEL_VideoSync,
|
||||
XSEL_VolumeControl,
|
||||
XSEL_AudioProcessing,
|
||||
};
|
||||
|
||||
// Main test function
|
||||
|
@ -31,6 +31,8 @@
|
||||
],
|
||||
'sources': [
|
||||
'auto_test/automated_mode.cc',
|
||||
'auto_test/extended/agc_config_test.cc',
|
||||
'auto_test/extended/ec_metrics_test.cc',
|
||||
'auto_test/fakes/fake_external_transport.cc',
|
||||
'auto_test/fakes/fake_external_transport.h',
|
||||
'auto_test/fixtures/after_initialization_fixture.cc',
|
||||
|
Loading…
Reference in New Issue
Block a user