Base ApmTest.Process on AudioProcessingStats.output_rms_dbfs
This replaces the current usage of AudioProcessing::level_estimator()
in that test.
The unit tests that specifically test the level_estimator API are left
in place, until the level_estimator API itself is removed.
Bug: webrtc:9947
Change-Id: I73301c1478d2c9763bb49598a692142229102876
Reviewed-on: https://webrtc-review.googlesource.com/c/114550
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26049}
diff --git a/modules/audio_processing/audio_processing_unittest.cc b/modules/audio_processing/audio_processing_unittest.cc
index 90882d7..d01333a 100644
--- a/modules/audio_processing/audio_processing_unittest.cc
+++ b/modules/audio_processing/audio_processing_unittest.cc
@@ -195,6 +195,7 @@
#endif
apm_config.high_pass_filter.enabled = true;
+ apm_config.level_estimation.enabled = true;
ap->ApplyConfig(apm_config);
EXPECT_NOERR(ap->level_estimator()->Enable(true));
@@ -1276,6 +1277,7 @@
AudioProcessing::Config config = apm_->GetConfig();
EXPECT_FALSE(config.echo_canceller.enabled);
EXPECT_FALSE(config.high_pass_filter.enabled);
+ EXPECT_FALSE(config.level_estimation.enabled);
EXPECT_FALSE(apm_->gain_control()->is_enabled());
EXPECT_FALSE(apm_->level_estimator()->is_enabled());
EXPECT_FALSE(apm_->noise_suppression()->is_enabled());
@@ -1835,6 +1837,7 @@
int analog_level_average = 0;
int max_output_average = 0;
float ns_speech_prob_average = 0.0f;
+ float rms_dbfs_average = 0.0f;
#if defined(WEBRTC_AUDIOPROC_FLOAT_PROFILE)
int stats_index = 0;
#endif
@@ -1869,6 +1872,9 @@
}
ns_speech_prob_average += apm_->noise_suppression()->speech_probability();
+ AudioProcessingStats stats =
+ apm_->GetStatistics(/*has_remote_tracks=*/false);
+ rms_dbfs_average += *stats.output_rms_dbfs;
size_t frame_size = frame_->samples_per_channel_ * frame_->num_channels_;
size_t write_count = fwrite(frame_->data(),
@@ -1904,11 +1910,6 @@
const int32_t delay_standard_deviation_ms =
stats.delay_standard_deviation_ms.value_or(-1.0);
- // Get RMS.
- int rms_level = apm_->level_estimator()->RMS();
- EXPECT_LE(0, rms_level);
- EXPECT_GE(127, rms_level);
-
if (!write_ref_data) {
const audioproc::Test::EchoMetrics& reference =
test->echo_metrics(stats_index);
@@ -1929,8 +1930,6 @@
EXPECT_EQ(reference_delay.median(), delay_median_ms);
EXPECT_EQ(reference_delay.std(), delay_standard_deviation_ms);
- EXPECT_EQ(test->rms_level(stats_index), rms_level);
-
++stats_index;
} else {
audioproc::Test::EchoMetrics* message_echo = test->add_echo_metrics();
@@ -1946,8 +1945,6 @@
test->add_delay_metrics();
message_delay->set_median(delay_median_ms);
message_delay->set_std(delay_standard_deviation_ms);
-
- test->add_rms_level(rms_level);
}
}
#endif // defined(WEBRTC_AUDIOPROC_FLOAT_PROFILE).
@@ -1955,6 +1952,7 @@
max_output_average /= frame_count;
analog_level_average /= frame_count;
ns_speech_prob_average /= frame_count;
+ rms_dbfs_average /= frame_count;
if (!write_ref_data) {
const int kIntNear = 1;
@@ -1989,6 +1987,7 @@
EXPECT_NEAR(test->ns_speech_probability_average(),
ns_speech_prob_average,
kFloatNear);
+ EXPECT_NEAR(test->rms_dbfs_average(), rms_dbfs_average, kFloatNear);
#endif
} else {
test->set_has_voice_count(has_voice_count);
@@ -2001,6 +2000,7 @@
EXPECT_LE(0.0f, ns_speech_prob_average);
EXPECT_GE(1.0f, ns_speech_prob_average);
test->set_ns_speech_probability_average(ns_speech_prob_average);
+ test->set_rms_dbfs_average(rms_dbfs_average);
#endif
}
diff --git a/modules/audio_processing/test/unittest.proto b/modules/audio_processing/test/unittest.proto
index 7cd1deb..07d1cda 100644
--- a/modules/audio_processing/test/unittest.proto
+++ b/modules/audio_processing/test/unittest.proto
@@ -35,7 +35,7 @@
repeated DelayMetrics delay_metrics = 12;
- repeated int32 rms_level = 13;
+ optional float rms_dbfs_average = 13;
optional float ns_speech_probability_average = 14;
diff --git a/resources/audio_processing/output_data_float.pb.sha1 b/resources/audio_processing/output_data_float.pb.sha1
index da3afc0..6cadef9 100644
--- a/resources/audio_processing/output_data_float.pb.sha1
+++ b/resources/audio_processing/output_data_float.pb.sha1
@@ -1 +1 @@
-82e9600c82f03c21e9feb33f82792d8d17908a5f
\ No newline at end of file
+f3f7efa512900b06a30af8e3c92aa7863fbc96f8
\ No newline at end of file
diff --git a/resources/audio_processing/output_data_mac.pb.sha1 b/resources/audio_processing/output_data_mac.pb.sha1
index 56c4bd6..0ebfdd2 100644
--- a/resources/audio_processing/output_data_mac.pb.sha1
+++ b/resources/audio_processing/output_data_mac.pb.sha1
@@ -1 +1 @@
-3f2550064d3e71c6428c3759dcce18bddec36690
\ No newline at end of file
+cc82c345f1e7ef17b12c2da41a0a9f73b09ca8f6
\ No newline at end of file