Update some audio processing tests to new VAD API
This updates some tests to use AudioProcesing::Config() and AudioProcessing::GetStatistics() instead. Some tests are left with voice_detection() because a) not all tests make sense to run both APIs in parallel, and b) we want test coverage of the old VoiceDetection until it is removed. Bug: webrtc:9947 Change-Id: Ifb21a1e6e931d7ad3c3a4e38f5cc4f146da3c9a3 Reviewed-on: https://webrtc-review.googlesource.com/c/116160 Reviewed-by: Alex Loiko <aleloi@webrtc.org> Commit-Queue: Sam Zackrisson <saza@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26134}
This commit is contained in:
committed by
Commit Bot
parent
ff98f4b1d8
commit
6c330ab63f
@ -590,6 +590,8 @@ bool StatsProcessor::Process() {
|
||||
apm_->noise_suppression()->speech_probability();
|
||||
apm_->voice_detection()->is_enabled();
|
||||
|
||||
apm_->GetStatistics(/*has_remote_tracks=*/true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -450,10 +450,10 @@ class CallSimulator : public ::testing::TestWithParam<SimulationConfig> {
|
||||
apm->gain_control()->set_mode(GainControl::kAdaptiveDigital));
|
||||
ASSERT_EQ(apm->kNoError, apm->gain_control()->Enable(true));
|
||||
ASSERT_EQ(apm->kNoError, apm->noise_suppression()->Enable(true));
|
||||
ASSERT_EQ(apm->kNoError, apm->voice_detection()->Enable(true));
|
||||
AudioProcessing::Config apm_config = apm->GetConfig();
|
||||
apm_config.echo_canceller.enabled = true;
|
||||
apm_config.echo_canceller.mobile_mode = false;
|
||||
apm_config.voice_detection.enabled = true;
|
||||
apm->ApplyConfig(apm_config);
|
||||
};
|
||||
|
||||
@ -465,10 +465,10 @@ class CallSimulator : public ::testing::TestWithParam<SimulationConfig> {
|
||||
apm->gain_control()->set_mode(GainControl::kAdaptiveDigital));
|
||||
ASSERT_EQ(apm->kNoError, apm->gain_control()->Enable(true));
|
||||
ASSERT_EQ(apm->kNoError, apm->noise_suppression()->Enable(true));
|
||||
ASSERT_EQ(apm->kNoError, apm->voice_detection()->Enable(true));
|
||||
AudioProcessing::Config apm_config = apm->GetConfig();
|
||||
apm_config.echo_canceller.enabled = true;
|
||||
apm_config.echo_canceller.mobile_mode = true;
|
||||
apm_config.voice_detection.enabled = true;
|
||||
apm->ApplyConfig(apm_config);
|
||||
};
|
||||
|
||||
@ -481,9 +481,9 @@ class CallSimulator : public ::testing::TestWithParam<SimulationConfig> {
|
||||
apm->gain_control()->set_mode(GainControl::kAdaptiveDigital));
|
||||
ASSERT_EQ(apm->kNoError, apm->gain_control()->Enable(false));
|
||||
ASSERT_EQ(apm->kNoError, apm->noise_suppression()->Enable(false));
|
||||
ASSERT_EQ(apm->kNoError, apm->voice_detection()->Enable(false));
|
||||
AudioProcessing::Config apm_config = apm->GetConfig();
|
||||
apm_config.echo_canceller.enabled = false;
|
||||
apm_config.voice_detection.enabled = false;
|
||||
apm->ApplyConfig(apm_config);
|
||||
};
|
||||
|
||||
|
||||
@ -1278,6 +1278,7 @@ TEST_F(ApmTest, AllProcessingDisabledByDefault) {
|
||||
EXPECT_FALSE(config.echo_canceller.enabled);
|
||||
EXPECT_FALSE(config.high_pass_filter.enabled);
|
||||
EXPECT_FALSE(config.level_estimation.enabled);
|
||||
EXPECT_FALSE(config.voice_detection.enabled);
|
||||
EXPECT_FALSE(apm_->gain_control()->is_enabled());
|
||||
EXPECT_FALSE(apm_->level_estimator()->is_enabled());
|
||||
EXPECT_FALSE(apm_->noise_suppression()->is_enabled());
|
||||
@ -1399,20 +1400,35 @@ TEST_F(ApmTest, SplittingFilter) {
|
||||
EXPECT_TRUE(FrameDataAreEqual(*frame_, frame_copy));
|
||||
EXPECT_EQ(apm_->kNoError, apm_->voice_detection()->Enable(false));
|
||||
|
||||
// 4. Both VAD and the level estimator are enabled...
|
||||
// 4. Only GetStatistics-reporting VAD is enabled...
|
||||
SetFrameTo(frame_, 1000);
|
||||
frame_copy.CopyFrom(*frame_);
|
||||
auto apm_config = apm_->GetConfig();
|
||||
apm_config.voice_detection.enabled = true;
|
||||
apm_->ApplyConfig(apm_config);
|
||||
EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_));
|
||||
EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_));
|
||||
EXPECT_TRUE(FrameDataAreEqual(*frame_, frame_copy));
|
||||
apm_config.voice_detection.enabled = false;
|
||||
apm_->ApplyConfig(apm_config);
|
||||
|
||||
// 5. Both VADs and the level estimator are enabled...
|
||||
SetFrameTo(frame_, 1000);
|
||||
frame_copy.CopyFrom(*frame_);
|
||||
EXPECT_EQ(apm_->kNoError, apm_->level_estimator()->Enable(true));
|
||||
EXPECT_EQ(apm_->kNoError, apm_->voice_detection()->Enable(true));
|
||||
apm_config.voice_detection.enabled = true;
|
||||
apm_->ApplyConfig(apm_config);
|
||||
EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_));
|
||||
EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_));
|
||||
EXPECT_TRUE(FrameDataAreEqual(*frame_, frame_copy));
|
||||
EXPECT_EQ(apm_->kNoError, apm_->level_estimator()->Enable(false));
|
||||
EXPECT_EQ(apm_->kNoError, apm_->voice_detection()->Enable(false));
|
||||
apm_config.voice_detection.enabled = false;
|
||||
apm_->ApplyConfig(apm_config);
|
||||
|
||||
// Check the test is valid. We should have distortion from the filter
|
||||
// when AEC is enabled (which won't affect the audio).
|
||||
AudioProcessing::Config apm_config = apm_->GetConfig();
|
||||
apm_config.echo_canceller.enabled = true;
|
||||
apm_config.echo_canceller.mobile_mode = false;
|
||||
apm_->ApplyConfig(apm_config);
|
||||
|
||||
@ -171,6 +171,7 @@ std::unique_ptr<AudioProcessing> CreateApm(test::FuzzDataHelper* fuzz_data,
|
||||
kPeak;
|
||||
apm_config.gain_controller2.adaptive_digital.use_saturation_protector =
|
||||
use_agc2_adaptive_digital_saturation_protector;
|
||||
apm_config.voice_detection.enabled = use_vad;
|
||||
|
||||
apm->ApplyConfig(apm_config);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user