Finished rewriting the audio processing test.
Partial rewrite of audio processing tests. BUG= TEST= Review URL: https://webrtc-codereview.appspot.com/367008 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1561 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
832adebca2
commit
048eb7cda6
@ -18,11 +18,11 @@ AfterStreamingFixture::AfterStreamingFixture()
|
||||
: channel_(voe_base_->CreateChannel()) {
|
||||
EXPECT_GE(channel_, 0);
|
||||
|
||||
const std::string& input_file = resource_manager_.long_audio_file_path();
|
||||
EXPECT_FALSE(input_file.empty());
|
||||
fake_microphone_input_file_ = resource_manager_.long_audio_file_path();
|
||||
EXPECT_FALSE(fake_microphone_input_file_.empty());
|
||||
|
||||
SetUpLocalPlayback();
|
||||
StartPlaying(input_file);
|
||||
StartPlaying();
|
||||
}
|
||||
|
||||
AfterStreamingFixture::~AfterStreamingFixture() {
|
||||
@ -34,6 +34,18 @@ AfterStreamingFixture::~AfterStreamingFixture() {
|
||||
voe_base_->DeleteChannel(channel_);
|
||||
}
|
||||
|
||||
void AfterStreamingFixture::SwitchToManualMicrophone() {
|
||||
EXPECT_EQ(0, voe_file_->StopPlayingFileAsMicrophone(channel_));
|
||||
|
||||
TEST_LOG("You need to speak manually into the microphone for this test.\n");
|
||||
Sleep(2000);
|
||||
}
|
||||
|
||||
void AfterStreamingFixture::RestartFakeMicrophone() {
|
||||
EXPECT_EQ(0, voe_file_->StartPlayingFileAsMicrophone(
|
||||
channel_, fake_microphone_input_file_.c_str(), true, true));
|
||||
}
|
||||
|
||||
void AfterStreamingFixture::SetUpLocalPlayback() {
|
||||
EXPECT_EQ(0, voe_base_->SetSendDestination(channel_, 8000, kLoopbackIp));
|
||||
EXPECT_EQ(0, voe_base_->SetLocalReceiver(0, 8000));
|
||||
@ -49,10 +61,9 @@ void AfterStreamingFixture::SetUpLocalPlayback() {
|
||||
voe_codec_->SetSendCodec(channel_, codec);
|
||||
}
|
||||
|
||||
void AfterStreamingFixture::StartPlaying(const std::string& input_file) {
|
||||
void AfterStreamingFixture::StartPlaying() {
|
||||
EXPECT_EQ(0, voe_base_->StartReceive(channel_));
|
||||
EXPECT_EQ(0, voe_base_->StartPlayout(channel_));
|
||||
EXPECT_EQ(0, voe_base_->StartSend(channel_));
|
||||
EXPECT_EQ(0, voe_file_->StartPlayingFileAsMicrophone(
|
||||
channel_, input_file.c_str(), true, true));
|
||||
RestartFakeMicrophone();
|
||||
}
|
||||
|
@ -26,10 +26,17 @@ class AfterStreamingFixture : public AfterInitializationFixture {
|
||||
protected:
|
||||
int channel_;
|
||||
ResourceManager resource_manager_;
|
||||
std::string fake_microphone_input_file_;
|
||||
|
||||
// Shuts off the fake microphone for this test.
|
||||
void SwitchToManualMicrophone();
|
||||
|
||||
// Restarts the fake microphone if it's been shut off earlier.
|
||||
void RestartFakeMicrophone();
|
||||
|
||||
private:
|
||||
void SetUpLocalPlayback();
|
||||
void StartPlaying(const std::string& input_file);
|
||||
void StartPlaying();
|
||||
};
|
||||
|
||||
|
||||
|
@ -0,0 +1,355 @@
|
||||
/*
|
||||
* 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 "after_streaming_fixture.h"
|
||||
#include "voe_standard_test.h"
|
||||
|
||||
class AudioProcessingTest : public AfterStreamingFixture {
|
||||
protected:
|
||||
// Note: Be careful with this one, it is used in the Android / iPhone part too.
|
||||
void TryEnablingAgcWithMode(webrtc::AgcModes agc_mode_to_set) {
|
||||
EXPECT_EQ(0, voe_apm_->SetAgcStatus(true, agc_mode_to_set));
|
||||
|
||||
bool agc_enabled = false;
|
||||
webrtc::AgcModes agc_mode = webrtc::kAgcDefault;
|
||||
|
||||
EXPECT_EQ(0, voe_apm_->GetAgcStatus(agc_enabled, agc_mode));
|
||||
EXPECT_TRUE(agc_enabled);
|
||||
EXPECT_EQ(agc_mode_to_set, agc_mode);
|
||||
}
|
||||
|
||||
void TryEnablingRxAgcWithMode(webrtc::AgcModes agc_mode_to_set) {
|
||||
EXPECT_EQ(0, voe_apm_->SetRxAgcStatus(channel_, true, agc_mode_to_set));
|
||||
|
||||
bool rx_agc_enabled = false;
|
||||
webrtc::AgcModes agc_mode = webrtc::kAgcDefault;
|
||||
|
||||
EXPECT_EQ(0, voe_apm_->GetRxAgcStatus(channel_, rx_agc_enabled, agc_mode));
|
||||
EXPECT_TRUE(rx_agc_enabled);
|
||||
EXPECT_EQ(agc_mode_to_set, agc_mode);
|
||||
}
|
||||
|
||||
// EC modes can map to other EC modes, so we have a separate parameter
|
||||
// for what we expect the EC mode to be set to.
|
||||
void TryEnablingEcWithMode(webrtc::EcModes ec_mode_to_set,
|
||||
webrtc::EcModes expected_mode) {
|
||||
EXPECT_EQ(0, voe_apm_->SetEcStatus(true, ec_mode_to_set));
|
||||
|
||||
bool ec_enabled = true;
|
||||
webrtc::EcModes ec_mode = webrtc::kEcDefault;
|
||||
|
||||
EXPECT_EQ(0, voe_apm_->GetEcStatus(ec_enabled, ec_mode));
|
||||
|
||||
EXPECT_EQ(expected_mode, ec_mode);
|
||||
}
|
||||
|
||||
// Here, the CNG mode will be expected to be on or off depending on the mode.
|
||||
void TryEnablingAecmWithMode(webrtc::AecmModes aecm_mode_to_set,
|
||||
bool cng_enabled_to_set) {
|
||||
EXPECT_EQ(0, voe_apm_->SetAecmMode(aecm_mode_to_set, cng_enabled_to_set));
|
||||
|
||||
bool cng_enabled = false;
|
||||
webrtc::AecmModes aecm_mode = webrtc::kAecmEarpiece;
|
||||
|
||||
voe_apm_->GetAecmMode(aecm_mode, cng_enabled);
|
||||
|
||||
EXPECT_EQ(cng_enabled_to_set, cng_enabled);
|
||||
EXPECT_EQ(aecm_mode_to_set, aecm_mode);
|
||||
}
|
||||
|
||||
void TryEnablingNsWithMode(webrtc::NsModes ns_mode_to_set,
|
||||
webrtc::NsModes expected_ns_mode) {
|
||||
EXPECT_EQ(0, voe_apm_->SetNsStatus(true, ns_mode_to_set));
|
||||
|
||||
bool ns_status = true;
|
||||
webrtc::NsModes ns_mode = webrtc::kNsDefault;
|
||||
EXPECT_EQ(0, voe_apm_->GetNsStatus(ns_status, ns_mode));
|
||||
|
||||
EXPECT_TRUE(ns_status);
|
||||
EXPECT_EQ(expected_ns_mode, ns_mode);
|
||||
}
|
||||
|
||||
void TryEnablingRxNsWithMode(webrtc::NsModes ns_mode_to_set,
|
||||
webrtc::NsModes expected_ns_mode) {
|
||||
EXPECT_EQ(0, voe_apm_->SetRxNsStatus(channel_, true, ns_mode_to_set));
|
||||
|
||||
bool ns_status = true;
|
||||
webrtc::NsModes ns_mode = webrtc::kNsDefault;
|
||||
EXPECT_EQ(0, voe_apm_->GetRxNsStatus(channel_, ns_status, ns_mode));
|
||||
|
||||
EXPECT_TRUE(ns_status);
|
||||
EXPECT_EQ(expected_ns_mode, ns_mode);
|
||||
}
|
||||
|
||||
void TryDetectingSilence() {
|
||||
// Here, speech is running. Shut down speech.
|
||||
EXPECT_EQ(0, voe_codec_->SetVADStatus(channel_, true));
|
||||
EXPECT_EQ(0, voe_volume_control_->SetInputMute(channel_, true));
|
||||
EXPECT_EQ(0, voe_file_->StopPlayingFileAsMicrophone(channel_));
|
||||
|
||||
// We should detect the silence after a short time.
|
||||
Sleep(500);
|
||||
EXPECT_EQ(0, voe_apm_->VoiceActivityIndicator(channel_));
|
||||
}
|
||||
|
||||
void TryDetectingSpeechAfterSilence() {
|
||||
// Re-enable speech.
|
||||
RestartFakeMicrophone();
|
||||
EXPECT_EQ(0, voe_codec_->SetVADStatus(channel_, false));
|
||||
EXPECT_EQ(0, voe_volume_control_->SetInputMute(channel_, false));
|
||||
|
||||
// We should detect the speech after a short time.
|
||||
Sleep(500);
|
||||
EXPECT_EQ(1, voe_apm_->VoiceActivityIndicator(channel_));
|
||||
}
|
||||
};
|
||||
|
||||
#if !(defined(MAC_IPHONE) && !defined(WEBRTC_ANDROID))
|
||||
|
||||
TEST_F(AudioProcessingTest, AgcIsOnByDefault) {
|
||||
bool agc_enabled = false;
|
||||
webrtc::AgcModes agc_mode = webrtc::kAgcAdaptiveAnalog;
|
||||
|
||||
EXPECT_EQ(0, voe_apm_->GetAgcStatus(agc_enabled, agc_mode));
|
||||
EXPECT_TRUE(agc_enabled);
|
||||
EXPECT_EQ(webrtc::kAgcAdaptiveAnalog, agc_mode);
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, CanEnableAgcWithAllModes) {
|
||||
TryEnablingAgcWithMode(webrtc::kAgcAdaptiveDigital);
|
||||
TryEnablingAgcWithMode(webrtc::kAgcAdaptiveAnalog);
|
||||
TryEnablingAgcWithMode(webrtc::kAgcFixedDigital);
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, EcIsDisabledAndAecIsDefaultEcMode) {
|
||||
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, EnablingEcAecShouldEnableEcAec) {
|
||||
TryEnablingEcWithMode(webrtc::kEcAec, webrtc::kEcAec);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// TODO(phoglund): Apparently, the part of the code we're testing here has
|
||||
// never seen production use, but this test will stick around while we
|
||||
// investigate whether to delete the production code.
|
||||
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);
|
||||
}
|
||||
|
||||
EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(false));
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, TestVoiceActivityDetectionWithObserver) {
|
||||
voetest::RxCallback rx_callback;
|
||||
EXPECT_EQ(0, voe_apm_->RegisterRxVadObserver(channel_, rx_callback));
|
||||
|
||||
TryDetectingSilence();
|
||||
|
||||
EXPECT_EQ(0, rx_callback._vadDecision);
|
||||
|
||||
TryDetectingSpeechAfterSilence();
|
||||
|
||||
EXPECT_EQ(1, rx_callback._vadDecision);
|
||||
|
||||
EXPECT_EQ(0, voe_apm_->DeRegisterRxVadObserver(channel_));
|
||||
}
|
||||
|
||||
#endif // !MAC_IPHONE && !WEBRTC_ANDROID
|
||||
|
||||
TEST_F(AudioProcessingTest, EnablingEcAecmShouldEnableEcAecm) {
|
||||
// This one apparently applies to Android and iPhone as well.
|
||||
TryEnablingEcWithMode(webrtc::kEcAecm, webrtc::kEcAecm);
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, EcAecmModeIsEnabledAndSpeakerphoneByDefault) {
|
||||
bool cng_enabled = false;
|
||||
webrtc::AecmModes aecm_mode = webrtc::kAecmEarpiece;
|
||||
|
||||
voe_apm_->GetAecmMode(aecm_mode, cng_enabled);
|
||||
|
||||
EXPECT_TRUE(cng_enabled);
|
||||
EXPECT_EQ(webrtc::kAecmSpeakerphone, aecm_mode);
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, CanSetAecmMode) {
|
||||
EXPECT_EQ(0, voe_apm_->SetEcStatus(true, webrtc::kEcAecm));
|
||||
|
||||
// Try some AECM mode - CNG enabled combinations.
|
||||
TryEnablingAecmWithMode(webrtc::kAecmEarpiece, true);
|
||||
TryEnablingAecmWithMode(webrtc::kAecmEarpiece, false);
|
||||
TryEnablingAecmWithMode(webrtc::kAecmLoudEarpiece, true);
|
||||
TryEnablingAecmWithMode(webrtc::kAecmLoudSpeakerphone, false);
|
||||
TryEnablingAecmWithMode(webrtc::kAecmQuietEarpieceOrHeadset, true);
|
||||
TryEnablingAecmWithMode(webrtc::kAecmSpeakerphone, false);
|
||||
}
|
||||
|
||||
// TODO(phoglund): rx-agc test are included when testing Android and iPhone, but
|
||||
// it is unclear if they will work on those platforms. Remove this notice if
|
||||
// they turn out to work, move into appropriate #ifdefs above otherwise.
|
||||
TEST_F(AudioProcessingTest, RxAgcShouldBeOffByDefault) {
|
||||
bool rx_agc_enabled = true;
|
||||
webrtc::AgcModes agc_mode = webrtc::kAgcDefault;
|
||||
|
||||
EXPECT_EQ(0, voe_apm_->GetRxAgcStatus(channel_, rx_agc_enabled, agc_mode));
|
||||
EXPECT_FALSE(rx_agc_enabled);
|
||||
EXPECT_EQ(webrtc::kAgcAdaptiveDigital, agc_mode);
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, CanTurnOnDigitalRxAcg) {
|
||||
TryEnablingRxAgcWithMode(webrtc::kAgcAdaptiveDigital);
|
||||
TryEnablingRxAgcWithMode(webrtc::kAgcFixedDigital);
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, CannotTurnOnAdaptiveDigitalRxAcg) {
|
||||
EXPECT_EQ(-1, voe_apm_->SetRxAgcStatus(
|
||||
channel_, true, webrtc::kAgcAdaptiveAnalog));
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, NsIsOffWithModerateSuppressionByDefault) {
|
||||
bool ns_status = true;
|
||||
webrtc::NsModes ns_mode = webrtc::kNsDefault;
|
||||
EXPECT_EQ(0, voe_apm_->GetNsStatus(ns_status, ns_mode));
|
||||
|
||||
EXPECT_FALSE(ns_status);
|
||||
EXPECT_EQ(webrtc::kNsModerateSuppression, ns_mode);
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, CanSetNsMode) {
|
||||
// Concrete suppression values map to themselves.
|
||||
TryEnablingNsWithMode(webrtc::kNsHighSuppression,
|
||||
webrtc::kNsHighSuppression);
|
||||
TryEnablingNsWithMode(webrtc::kNsLowSuppression,
|
||||
webrtc::kNsLowSuppression);
|
||||
TryEnablingNsWithMode(webrtc::kNsModerateSuppression,
|
||||
webrtc::kNsModerateSuppression);
|
||||
TryEnablingNsWithMode(webrtc::kNsVeryHighSuppression,
|
||||
webrtc::kNsVeryHighSuppression);
|
||||
|
||||
// Conference and Default map to concrete values.
|
||||
TryEnablingNsWithMode(webrtc::kNsConference,
|
||||
webrtc::kNsHighSuppression);
|
||||
TryEnablingNsWithMode(webrtc::kNsDefault,
|
||||
webrtc::kNsModerateSuppression);
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, RxNsIsOffWithModerateSuppressionByDefault) {
|
||||
bool ns_status = true;
|
||||
webrtc::NsModes ns_mode = webrtc::kNsDefault;
|
||||
EXPECT_EQ(0, voe_apm_->GetRxNsStatus(channel_, ns_status, ns_mode));
|
||||
|
||||
EXPECT_FALSE(ns_status);
|
||||
EXPECT_EQ(webrtc::kNsModerateSuppression, ns_mode);
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, CanSetRxNsMode) {
|
||||
EXPECT_EQ(0, voe_apm_->SetRxNsStatus(channel_, true));
|
||||
|
||||
// See comments on the regular NS test above.
|
||||
TryEnablingRxNsWithMode(webrtc::kNsHighSuppression,
|
||||
webrtc::kNsHighSuppression);
|
||||
TryEnablingRxNsWithMode(webrtc::kNsLowSuppression,
|
||||
webrtc::kNsLowSuppression);
|
||||
TryEnablingRxNsWithMode(webrtc::kNsModerateSuppression,
|
||||
webrtc::kNsModerateSuppression);
|
||||
TryEnablingRxNsWithMode(webrtc::kNsVeryHighSuppression,
|
||||
webrtc::kNsVeryHighSuppression);
|
||||
TryEnablingRxNsWithMode(webrtc::kNsConference,
|
||||
webrtc::kNsHighSuppression);
|
||||
TryEnablingRxNsWithMode(webrtc::kNsDefault,
|
||||
webrtc::kNsModerateSuppression);
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, VadIsDisabledByDefault) {
|
||||
bool vad_enabled;
|
||||
bool disabled_dtx;
|
||||
webrtc::VadModes vad_mode;
|
||||
|
||||
EXPECT_EQ(0, voe_codec_->GetVADStatus(
|
||||
channel_, vad_enabled, vad_mode, disabled_dtx));
|
||||
|
||||
EXPECT_FALSE(vad_enabled);
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, VoiceActivityIndicatorReturns1WithSpeechOn) {
|
||||
// This sleep is necessary since the voice detection algorithm needs some
|
||||
// time to detect the speech from the fake microphone.
|
||||
Sleep(500);
|
||||
EXPECT_EQ(1, voe_apm_->VoiceActivityIndicator(channel_));
|
||||
}
|
||||
|
||||
#if (defined(MAC_IPHONE) || defined(WEBRTC_ANDROID))
|
||||
|
||||
TEST_F(AudioProcessingTest, AgcIsOffByDefaultAndDigital) {
|
||||
bool agc_enabled = true;
|
||||
webrtc::AgcModes acg_mode = webrtc::kAgcAdaptiveAnalog;
|
||||
|
||||
EXPECT_EQ(0, voe_apm_->GetAgcStatus(agc_enabled, acg_mode));
|
||||
EXPECT_FALSE(agc_enabled);
|
||||
EXPECT_EQ(webrtc::kAgcAdaptiveDigital, acg_mode);
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, CanEnableAgcInAdaptiveDigitalMode) {
|
||||
TryEnablingAgcWithMode(webrtc::kAgcAdaptiveDigital);
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, AgcIsPossibleExceptInAdaptiveAnalogMode) {
|
||||
EXPECT_EQ(-1, voe_apm_->SetAgcStatus(true, webrtc::kAgcAdaptiveAnalog));
|
||||
EXPECT_EQ(0, voe_apm_->SetAgcStatus(true, webrtc::kAgcFixedDigital));
|
||||
EXPECT_EQ(0, voe_apm_->SetAgcStatus(true, webrtc::kAgcAdaptiveDigital));
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, EcIsDisabledAndAecmIsDefaultEcMode) {
|
||||
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::kEcAecm, ec_mode);
|
||||
}
|
||||
|
||||
TEST_F(AudioProcessingTest, TestVoiceActivityDetection) {
|
||||
TryDetectingSilence();
|
||||
TryDetectingSpeechAfterSilence();
|
||||
}
|
||||
|
||||
#endif // MAC_IPHONE || WEBRTC_ANDROID
|
@ -11,13 +11,6 @@
|
||||
#include "after_streaming_fixture.h"
|
||||
|
||||
class VolumeTest : public AfterStreamingFixture {
|
||||
protected:
|
||||
void SwitchToManualMicrophone() {
|
||||
EXPECT_EQ(0, voe_file_->StopPlayingFileAsMicrophone(channel_));
|
||||
|
||||
TEST_LOG("You need to speak manually into the microphone for this test.\n");
|
||||
Sleep(2000);
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(VolumeTest, DefaultSpeakerVolumeIsAtMost255) {
|
||||
|
@ -983,404 +983,6 @@ int VoETestManager::DoStandardTest() {
|
||||
if (TestStartStreaming(channel0_transport) != 0) return -1;
|
||||
if (TestStartPlaying() != 0) return -1;
|
||||
|
||||
///////
|
||||
// AudioProcessing
|
||||
|
||||
#ifdef _TEST_AUDIO_PROCESSING_
|
||||
TEST_LOG("\n\n+++ AudioProcessing tests +++\n\n");
|
||||
#ifdef WEBRTC_VOICE_ENGINE_AGC
|
||||
bool test;
|
||||
TEST_LOG("AGC calls\n");
|
||||
#if (defined(MAC_IPHONE) || defined(WEBRTC_ANDROID))
|
||||
TEST_LOG("Must be OFF by default\n");
|
||||
test = true;
|
||||
AgcModes agcMode = kAgcAdaptiveAnalog;
|
||||
TEST_MUSTPASS(voe_apm_->GetAgcStatus(test, agcMode));
|
||||
TEST_MUSTPASS(test);
|
||||
TEST_MUSTPASS(kAgcAdaptiveDigital != agcMode);
|
||||
#else
|
||||
TEST_LOG("Must be ON by default\n");
|
||||
test = false;
|
||||
AgcModes agcMode = kAgcAdaptiveAnalog;
|
||||
TEST_MUSTPASS(voe_apm_->GetAgcStatus(test, agcMode));
|
||||
TEST_MUSTPASS(!test);
|
||||
TEST_MUSTPASS(kAgcAdaptiveAnalog != agcMode);
|
||||
|
||||
TEST_LOG("Turn off AGC\n");
|
||||
// must set value in first call!
|
||||
TEST_MUSTPASS(voe_apm_->SetAgcStatus(false, kAgcDefault));
|
||||
TEST_LOG("Should be OFF now\n");
|
||||
TEST_MUSTPASS(voe_apm_->GetAgcStatus(test, agcMode));
|
||||
TEST_MUSTPASS(test);
|
||||
TEST_MUSTPASS(kAgcAdaptiveAnalog != agcMode);
|
||||
#endif // #if (defined(MAC_IPHONE) || defined(WEBRTC_ANDROID))
|
||||
TEST_LOG("Turn ON AGC\n");
|
||||
#if (defined(MAC_IPHONE) || defined(WEBRTC_ANDROID))
|
||||
TEST_MUSTPASS(voe_apm_->SetAgcStatus(true, kAgcAdaptiveDigital));
|
||||
#else
|
||||
TEST_MUSTPASS(voe_apm_->SetAgcStatus(true));
|
||||
#endif
|
||||
TEST_LOG("Should be ON now\n");
|
||||
TEST_MUSTPASS(voe_apm_->GetAgcStatus(test, agcMode));
|
||||
TEST_MUSTPASS(!test);
|
||||
#if (defined(MAC_IPHONE) || defined(WEBRTC_ANDROID))
|
||||
TEST_MUSTPASS(kAgcAdaptiveDigital != agcMode);
|
||||
#else
|
||||
TEST_MUSTPASS(kAgcAdaptiveAnalog != agcMode);
|
||||
#endif
|
||||
|
||||
#if (defined(MAC_IPHONE) || defined(WEBRTC_ANDROID))
|
||||
TEST_LOG("Testing Type settings\n");
|
||||
// Should fail
|
||||
TEST_MUSTPASS(!voe_apm_->SetAgcStatus(true, kAgcAdaptiveAnalog));
|
||||
// Should fail
|
||||
TEST_MUSTPASS(voe_apm_->SetAgcStatus(true, kAgcFixedDigital));
|
||||
// Should fail
|
||||
TEST_MUSTPASS(voe_apm_->SetAgcStatus(true, kAgcAdaptiveDigital));
|
||||
|
||||
TEST_LOG("Turn off AGC\n");
|
||||
TEST_MUSTPASS(voe_apm_->SetAgcStatus(false));
|
||||
TEST_LOG("Should be OFF now\n");
|
||||
TEST_MUSTPASS(voe_apm_->GetAgcStatus(test, agcMode));
|
||||
TEST_MUSTPASS(test);
|
||||
TEST_MUSTPASS(kAgcAdaptiveDigital != agcMode);
|
||||
#else
|
||||
TEST_LOG("Testing Mode settings\n");
|
||||
TEST_MUSTPASS(voe_apm_->SetAgcStatus(true, kAgcFixedDigital));
|
||||
TEST_MUSTPASS(voe_apm_->GetAgcStatus(test, agcMode));
|
||||
TEST_MUSTPASS(kAgcFixedDigital != agcMode);
|
||||
TEST_MUSTPASS(voe_apm_->SetAgcStatus(true, kAgcAdaptiveDigital));
|
||||
TEST_MUSTPASS(voe_apm_->GetAgcStatus(test, agcMode));
|
||||
TEST_MUSTPASS(kAgcAdaptiveDigital != agcMode);
|
||||
TEST_MUSTPASS(voe_apm_->SetAgcStatus(true, kAgcAdaptiveAnalog));
|
||||
TEST_MUSTPASS(voe_apm_->GetAgcStatus(test, agcMode));
|
||||
TEST_MUSTPASS(kAgcAdaptiveAnalog != agcMode);
|
||||
#endif // #if (defined(MAC_IPHONE) || defined(WEBRTC_ANDROID))
|
||||
TEST_LOG("rxAGC calls\n");
|
||||
// Note the following test is not tested in iphone, android and wince,
|
||||
// you may run into issue
|
||||
|
||||
bool rxAGCTemp(false);
|
||||
AgcModes rxAGCModeTemp(kAgcAdaptiveAnalog);
|
||||
// Store current state
|
||||
TEST_MUSTPASS(voe_apm_->GetAgcStatus(rxAGCTemp, rxAGCModeTemp));
|
||||
TEST_LOG("Turn off near-end AGC\n");
|
||||
TEST_MUSTPASS(voe_apm_->SetAgcStatus(false));
|
||||
|
||||
TEST_LOG("rxAGC Must be OFF by default\n");
|
||||
test = true;
|
||||
AgcModes rxAGCMode = kAgcAdaptiveDigital;
|
||||
TEST_MUSTPASS(voe_apm_->GetRxAgcStatus(0, test, agcMode));
|
||||
TEST_MUSTPASS(test);
|
||||
TEST_MUSTPASS(kAgcAdaptiveDigital != rxAGCMode);
|
||||
|
||||
TEST_LOG("Turn off rxAGC\n");
|
||||
// must set value in first call!
|
||||
TEST_MUSTPASS(voe_apm_->SetRxAgcStatus(0, false, kAgcDefault));
|
||||
TEST_LOG("Should be OFF now\n");
|
||||
TEST_MUSTPASS(voe_apm_->GetRxAgcStatus(0, test, agcMode));
|
||||
TEST_MUSTPASS(test);
|
||||
TEST_MUSTPASS(kAgcAdaptiveDigital != rxAGCMode);
|
||||
|
||||
TEST_LOG("Turn ON AGC\n");
|
||||
TEST_MUSTPASS(voe_apm_->SetRxAgcStatus(0, true));
|
||||
TEST_LOG("Should be ON now\n");
|
||||
TEST_MUSTPASS(voe_apm_->GetRxAgcStatus(0, test, agcMode));
|
||||
TEST_MUSTPASS(!test);
|
||||
TEST_MUSTPASS(kAgcAdaptiveDigital != agcMode);
|
||||
|
||||
TEST_LOG("Testing Type settings\n");
|
||||
// Should fail
|
||||
TEST_MUSTPASS(!voe_apm_->SetRxAgcStatus(0, true, kAgcAdaptiveAnalog));
|
||||
TEST_MUSTPASS(voe_apm_->SetRxAgcStatus(0, true, kAgcFixedDigital));
|
||||
TEST_MUSTPASS(voe_apm_->GetRxAgcStatus(0, test, agcMode));
|
||||
TEST_MUSTPASS(kAgcFixedDigital != agcMode);
|
||||
TEST_MUSTPASS(voe_apm_->SetRxAgcStatus(0, true, kAgcAdaptiveDigital));
|
||||
TEST_MUSTPASS(voe_apm_->GetRxAgcStatus(0, test, agcMode));
|
||||
TEST_MUSTPASS(kAgcAdaptiveDigital != agcMode);
|
||||
|
||||
TEST_LOG("Turn off AGC\n");
|
||||
TEST_MUSTPASS(voe_apm_->SetRxAgcStatus(0, false));
|
||||
TEST_LOG("Should be OFF now\n");
|
||||
TEST_MUSTPASS(voe_apm_->GetRxAgcStatus(0, test, agcMode));
|
||||
TEST_MUSTPASS(test);
|
||||
TEST_MUSTPASS(kAgcAdaptiveDigital != agcMode);
|
||||
|
||||
// recover the old AGC mode
|
||||
TEST_MUSTPASS(voe_apm_->SetAgcStatus(rxAGCTemp, rxAGCModeTemp));
|
||||
|
||||
#else
|
||||
TEST_LOG("Skipping AGC tests - WEBRTC_VOICE_ENGINE_AGC not defined \n");
|
||||
#endif // #ifdef WEBRTC_VOICE_ENGINE_AGC
|
||||
#ifdef WEBRTC_VOICE_ENGINE_ECHO
|
||||
TEST_LOG("EC calls\n");
|
||||
TEST_LOG("Must be OFF by default\n");
|
||||
#if (defined(MAC_IPHONE) || defined(WEBRTC_ANDROID))
|
||||
const EcModes ecModeDefault = kEcAecm;
|
||||
#else
|
||||
const EcModes ecModeDefault = kEcAec;
|
||||
#endif
|
||||
test = true;
|
||||
EcModes ecMode = kEcAec;
|
||||
AecmModes aecmMode = kAecmSpeakerphone;
|
||||
bool enabledCNG(false);
|
||||
TEST_MUSTPASS(voe_apm_->GetEcStatus(test, ecMode));
|
||||
TEST_MUSTPASS(test);
|
||||
TEST_MUSTPASS(ecModeDefault != ecMode);
|
||||
TEST_MUSTPASS(voe_apm_->GetAecmMode(aecmMode, enabledCNG));
|
||||
TEST_LOG("default AECM: mode=%d CNG: mode=%d\n", aecmMode, enabledCNG);
|
||||
TEST_MUSTPASS(kAecmSpeakerphone != aecmMode);
|
||||
TEST_MUSTPASS(enabledCNG != true);
|
||||
TEST_MUSTPASS(voe_apm_->SetAecmMode(kAecmQuietEarpieceOrHeadset, false));
|
||||
TEST_MUSTPASS(voe_apm_->GetAecmMode(aecmMode, enabledCNG));
|
||||
TEST_LOG("change AECM to mode=%d CNG to false\n", aecmMode);
|
||||
TEST_MUSTPASS(aecmMode != kAecmQuietEarpieceOrHeadset);
|
||||
TEST_MUSTPASS(enabledCNG != false);
|
||||
|
||||
TEST_LOG("Turn ON EC\n");
|
||||
TEST_MUSTPASS(voe_apm_->SetEcStatus(true, ecModeDefault));
|
||||
TEST_LOG("Should be ON now\n");
|
||||
TEST_MUSTPASS(voe_apm_->GetEcStatus(test, ecMode));
|
||||
TEST_MUSTPASS(!test);
|
||||
TEST_MUSTPASS(ecModeDefault != ecMode);
|
||||
|
||||
#if (!defined(MAC_IPHONE) && !defined(WEBRTC_ANDROID))
|
||||
TEST_MUSTPASS(voe_apm_->SetEcStatus(true, kEcAec));
|
||||
TEST_MUSTPASS(voe_apm_->GetEcStatus(test, ecMode));
|
||||
TEST_MUSTPASS(kEcAec != ecMode);
|
||||
|
||||
TEST_MUSTPASS(voe_apm_->SetEcStatus(true, kEcConference));
|
||||
TEST_MUSTPASS(voe_apm_->GetEcStatus(test, ecMode));
|
||||
TEST_MUSTPASS(kEcAec != ecMode);
|
||||
|
||||
// the samplefreq for AudioProcessing is 32k, so it wont work to
|
||||
// activate AECM
|
||||
TEST_MUSTPASS(voe_apm_->SetEcStatus(true, kEcAecm));
|
||||
TEST_MUSTPASS(voe_apm_->GetEcStatus(test, ecMode));
|
||||
TEST_MUSTPASS(kEcAecm != ecMode);
|
||||
#endif
|
||||
|
||||
// set kEcAecm mode
|
||||
TEST_LOG("Testing AECM Mode settings\n");
|
||||
TEST_MUSTPASS(voe_apm_->SetEcStatus(true, kEcAecm));
|
||||
TEST_MUSTPASS(voe_apm_->GetEcStatus(test, ecMode));
|
||||
TEST_LOG("EC: enabled=%d, ECmode=%d\n", test, ecMode);
|
||||
TEST_MUSTPASS(test != true);
|
||||
TEST_MUSTPASS(ecMode != kEcAecm);
|
||||
|
||||
// AECM mode, get and set
|
||||
TEST_MUSTPASS(voe_apm_->GetAecmMode(aecmMode, enabledCNG));
|
||||
TEST_MUSTPASS(aecmMode != kAecmQuietEarpieceOrHeadset);
|
||||
TEST_MUSTPASS(enabledCNG != false);
|
||||
TEST_MUSTPASS(voe_apm_->SetAecmMode(kAecmEarpiece, true));
|
||||
TEST_MUSTPASS(voe_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(voe_apm_->SetAecmMode(kAecmEarpiece, false));
|
||||
TEST_MUSTPASS(voe_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(voe_apm_->SetAecmMode(kAecmLoudEarpiece, true));
|
||||
TEST_MUSTPASS(voe_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(voe_apm_->SetAecmMode(kAecmSpeakerphone, false));
|
||||
TEST_MUSTPASS(voe_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(voe_apm_->SetAecmMode(kAecmLoudSpeakerphone, true));
|
||||
TEST_MUSTPASS(voe_apm_->GetAecmMode(aecmMode, enabledCNG));
|
||||
TEST_LOG("AECM: mode=%d CNG: mode=%d\n", aecmMode, enabledCNG);
|
||||
TEST_MUSTPASS(aecmMode != kAecmLoudSpeakerphone);
|
||||
TEST_MUSTPASS(enabledCNG != true);
|
||||
|
||||
TEST_LOG("Turn OFF AEC\n");
|
||||
TEST_MUSTPASS(voe_apm_->SetEcStatus(false));
|
||||
TEST_LOG("Should be OFF now\n");
|
||||
TEST_MUSTPASS(voe_apm_->GetEcStatus(test, ecMode));
|
||||
TEST_MUSTPASS(test);
|
||||
#else
|
||||
TEST_LOG("Skipping echo cancellation tests -"
|
||||
" WEBRTC_VOICE_ENGINE_ECHO not defined \n");
|
||||
#endif // #ifdef WEBRTC_VOICE_ENGINE_ECHO
|
||||
#ifdef WEBRTC_VOICE_ENGINE_NR
|
||||
TEST_LOG("NS calls\n");
|
||||
TEST_LOG("Must be OFF by default\n");
|
||||
|
||||
NsModes nsModeDefault = kNsModerateSuppression;
|
||||
|
||||
test = true;
|
||||
NsModes nsMode = kNsVeryHighSuppression;
|
||||
TEST_MUSTPASS(voe_apm_->GetNsStatus(test, nsMode));
|
||||
TEST_MUSTPASS(test);
|
||||
TEST_MUSTPASS(nsModeDefault != nsMode);
|
||||
|
||||
TEST_LOG("Turn ON NS\n");
|
||||
TEST_MUSTPASS(voe_apm_->SetNsStatus(true));
|
||||
TEST_LOG("Should be ON now\n");
|
||||
TEST_MUSTPASS(voe_apm_->GetNsStatus(test, nsMode));
|
||||
TEST_MUSTPASS(!test);
|
||||
TEST_MUSTPASS(nsModeDefault != nsMode);
|
||||
|
||||
TEST_LOG("Testing Mode settings\n");
|
||||
TEST_MUSTPASS(voe_apm_->SetNsStatus(true, kNsLowSuppression));
|
||||
TEST_MUSTPASS(voe_apm_->GetNsStatus(test, nsMode));
|
||||
TEST_MUSTPASS(kNsLowSuppression != nsMode);
|
||||
TEST_MUSTPASS(voe_apm_->SetNsStatus(true, kNsModerateSuppression));
|
||||
TEST_MUSTPASS(voe_apm_->GetNsStatus(test, nsMode));
|
||||
TEST_MUSTPASS(kNsModerateSuppression != nsMode);
|
||||
TEST_MUSTPASS(voe_apm_->SetNsStatus(true, kNsHighSuppression));
|
||||
TEST_MUSTPASS(voe_apm_->GetNsStatus(test, nsMode));
|
||||
TEST_MUSTPASS(kNsHighSuppression != nsMode);
|
||||
TEST_MUSTPASS(voe_apm_->SetNsStatus(true, kNsVeryHighSuppression));
|
||||
TEST_MUSTPASS(voe_apm_->GetNsStatus(test, nsMode));
|
||||
TEST_MUSTPASS(kNsVeryHighSuppression != nsMode);
|
||||
TEST_MUSTPASS(voe_apm_->SetNsStatus(true, kNsConference));
|
||||
TEST_MUSTPASS(voe_apm_->GetNsStatus(test, nsMode));
|
||||
TEST_MUSTPASS(kNsHighSuppression != nsMode);
|
||||
TEST_MUSTPASS(voe_apm_->SetNsStatus(true, kNsDefault));
|
||||
TEST_MUSTPASS(voe_apm_->GetNsStatus(test, nsMode));
|
||||
TEST_MUSTPASS(nsModeDefault != nsMode);
|
||||
|
||||
TEST_LOG("Turn OFF NS\n");
|
||||
TEST_MUSTPASS(voe_apm_->SetNsStatus(false));
|
||||
TEST_LOG("Should be OFF now\n");
|
||||
TEST_MUSTPASS(voe_apm_->GetNsStatus(test, nsMode));
|
||||
TEST_MUSTPASS(test);
|
||||
|
||||
TEST_LOG("rxNS calls\n");
|
||||
TEST_LOG("rxNS Must be OFF by default\n");
|
||||
|
||||
TEST_MUSTPASS(voe_apm_->GetRxNsStatus(0, test, nsMode));
|
||||
TEST_MUSTPASS(test);
|
||||
TEST_MUSTPASS(nsModeDefault != nsMode);
|
||||
|
||||
TEST_LOG("Turn ON rxNS\n");
|
||||
TEST_MUSTPASS(voe_apm_->SetRxNsStatus(0, true));
|
||||
TEST_LOG("Should be ON now\n");
|
||||
TEST_MUSTPASS(voe_apm_->GetRxNsStatus(0, test, nsMode));
|
||||
TEST_MUSTPASS(!test);
|
||||
TEST_MUSTPASS(nsModeDefault != nsMode);
|
||||
|
||||
TEST_LOG("Testing Mode settings\n");
|
||||
TEST_MUSTPASS(voe_apm_->SetRxNsStatus(0, true, kNsLowSuppression));
|
||||
TEST_MUSTPASS(voe_apm_->GetRxNsStatus(0, test, nsMode));
|
||||
TEST_MUSTPASS(kNsLowSuppression != nsMode);
|
||||
TEST_MUSTPASS(voe_apm_->SetRxNsStatus(0, true, kNsModerateSuppression));
|
||||
TEST_MUSTPASS(voe_apm_->GetRxNsStatus(0, test, nsMode));
|
||||
TEST_MUSTPASS(kNsModerateSuppression != nsMode);
|
||||
TEST_MUSTPASS(voe_apm_->SetRxNsStatus(0, true, kNsHighSuppression));
|
||||
TEST_MUSTPASS(voe_apm_->GetRxNsStatus(0, test, nsMode));
|
||||
TEST_MUSTPASS(kNsHighSuppression != nsMode);
|
||||
TEST_MUSTPASS(voe_apm_->SetRxNsStatus(0, true, kNsVeryHighSuppression));
|
||||
TEST_MUSTPASS(voe_apm_->GetRxNsStatus(0, test, nsMode));
|
||||
TEST_MUSTPASS(kNsVeryHighSuppression != nsMode);
|
||||
TEST_MUSTPASS(voe_apm_->SetRxNsStatus(0, true, kNsConference));
|
||||
TEST_MUSTPASS(voe_apm_->GetRxNsStatus(0, test, nsMode));
|
||||
TEST_MUSTPASS(kNsHighSuppression != nsMode);
|
||||
TEST_MUSTPASS(voe_apm_->SetRxNsStatus(0, true, kNsDefault));
|
||||
TEST_MUSTPASS(voe_apm_->GetRxNsStatus(0, test, nsMode));
|
||||
TEST_MUSTPASS(nsModeDefault != nsMode);
|
||||
|
||||
TEST_LOG("Turn OFF NS\n");
|
||||
TEST_MUSTPASS(voe_apm_->SetRxNsStatus(0, false));
|
||||
TEST_LOG("Should be OFF now\n");
|
||||
TEST_MUSTPASS(voe_apm_->GetRxNsStatus(0, test, nsMode));
|
||||
TEST_MUSTPASS(test);
|
||||
|
||||
#else
|
||||
TEST_LOG("Skipping NS tests - WEBRTC_VOICE_ENGINE_NR not defined \n");
|
||||
#endif // #ifdef WEBRTC_VOICE_ENGINE_NR
|
||||
#if (!defined(MAC_IPHONE) && !defined(WEBRTC_ANDROID) && \
|
||||
defined(WEBRTC_VOICE_ENGINE_NR))
|
||||
#ifdef WEBRTC_VOICE_ENGINE_ECHO
|
||||
bool enabled = false;
|
||||
TEST_LOG("EC Metrics calls\n");
|
||||
TEST_MUSTPASS(voe_apm_->GetEcMetricsStatus(enabled)); // check default
|
||||
TEST_MUSTPASS(enabled != false);
|
||||
TEST_MUSTPASS(voe_apm_->SetEcMetricsStatus(true)); // enable EC metrics
|
||||
// must enable AEC to get valid echo metrics
|
||||
TEST_MUSTPASS(voe_apm_->SetEcStatus(true, kEcAec));
|
||||
TEST_MUSTPASS(voe_apm_->GetEcMetricsStatus(enabled));
|
||||
TEST_MUSTPASS(enabled != true);
|
||||
|
||||
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 t = 0; t < 5; t++) {
|
||||
SLEEP(2000);
|
||||
TEST_MUSTPASS(voe_apm_->GetEchoMetrics(ERL, ERLE, RERL, A_NLP));
|
||||
TEST_MUSTPASS(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_MUSTPASS(voe_apm_->SetEcMetricsStatus(false)); // disable echo metrics
|
||||
#else
|
||||
TEST_LOG("Skipping Echo Control metrics tests -"
|
||||
" WEBRTC_VOICE_ENGINE_ECHO not defined \n");
|
||||
#endif // #ifdef WEBRTC_VOICE_ENGINE_ECHO
|
||||
#else
|
||||
TEST_LOG("Skipping apm metrics tests - MAC_IPHONE/WEBRTC_ANDROID defined \n");
|
||||
#endif // #if (!defined(MAC_IPHONE) && !d...
|
||||
// VAD/DTX indication
|
||||
TEST_LOG("Get voice activity indication \n");
|
||||
if (voe_codec_) {
|
||||
bool v = true, dummy2;
|
||||
VadModes dummy1;
|
||||
TEST_MUSTPASS(voe_codec_->GetVADStatus(0, v, dummy1, dummy2));
|
||||
TEST_MUSTPASS(v); // Make sure VAD is disabled
|
||||
}
|
||||
TEST_MUSTPASS(1 != voe_apm_->VoiceActivityIndicator(0));
|
||||
if (voe_codec_ && voe_volume_control_) {
|
||||
TEST_LOG("RX VAD detections may vary depending on current signal"
|
||||
" and mic input \n");
|
||||
#if !defined(WEBRTC_ANDROID) && !defined(MAC_IPHONE)
|
||||
RxCallback rxc;
|
||||
TEST_MUSTPASS(voe_apm_->RegisterRxVadObserver(0, rxc));
|
||||
#endif
|
||||
TEST_MUSTPASS(voe_codec_->SetVADStatus(0, true));
|
||||
TEST_MUSTPASS(voe_volume_control_->SetInputMute(0, true));
|
||||
if (voe_file_) {
|
||||
TEST_MUSTPASS(voe_file_->StopPlayingFileAsMicrophone(0));
|
||||
}
|
||||
SLEEP(500); // After sleeping we should have detected silence
|
||||
TEST_MUSTPASS(0 != voe_apm_->VoiceActivityIndicator(0));
|
||||
#if !defined(WEBRTC_ANDROID) && !defined(MAC_IPHONE)
|
||||
TEST_MUSTPASS(0 != rxc._vadDecision);
|
||||
#endif
|
||||
if (voe_file_) {
|
||||
TEST_LOG("Start playing a file as microphone again \n");
|
||||
TEST_MUSTPASS(voe_file_->StartPlayingFileAsMicrophone(
|
||||
0, AudioFilename(), true, true));
|
||||
} else {
|
||||
TEST_LOG("==> Make sure you talk into the microphone \n");
|
||||
}
|
||||
TEST_MUSTPASS(voe_codec_->SetVADStatus(0, false));
|
||||
TEST_MUSTPASS(voe_volume_control_->SetInputMute(0, false));
|
||||
SLEEP(500); // Sleep time selected by looking in mic play file, after
|
||||
// sleep we should have detected voice
|
||||
TEST_MUSTPASS(1 != voe_apm_->VoiceActivityIndicator(0));
|
||||
#if !defined(WEBRTC_ANDROID) && !defined(MAC_IPHONE)
|
||||
TEST_MUSTPASS(1 != rxc._vadDecision);
|
||||
TEST_LOG("Disabling RX VAD detection, make sure you see no "
|
||||
"detections\n");
|
||||
TEST_MUSTPASS(voe_apm_->DeRegisterRxVadObserver(0));
|
||||
SLEEP(2000);
|
||||
#endif
|
||||
} else {
|
||||
TEST_LOG("Skipping voice activity indicator tests - codec and"
|
||||
" volume APIs not available \n");
|
||||
}
|
||||
|
||||
#else
|
||||
TEST_LOG("\n\n+++ AudioProcessing tests NOT ENABLED +++\n");
|
||||
#endif // #ifdef _TEST_AUDIO_PROCESSING_
|
||||
////////
|
||||
// File
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
'auto_test/fixtures/after_streaming_fixture.h',
|
||||
'auto_test/fixtures/before_initialization_fixture.cc',
|
||||
'auto_test/fixtures/before_initialization_fixture.h',
|
||||
'auto_test/standard/audio_processing_test.cc',
|
||||
'auto_test/standard/codec_before_streaming_test.cc',
|
||||
'auto_test/standard/codec_test.cc',
|
||||
'auto_test/standard/dtmf_test.cc',
|
||||
|
Loading…
x
Reference in New Issue
Block a user