Add AudioProcessingCaptureStats and a level estimator replacement
This adds an interface for accessing stats on the capture stream, and
adds a level estimator to report one of the stats.
Bug: webrtc:9947
Change-Id: Id472534fa2e04d46c9ab700671f620584a246afb
Reviewed-on: https://webrtc-review.googlesource.com/c/109587
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Ã…hgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25786}
diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h
index 9a1a03c..df51313 100644
--- a/modules/audio_processing/include/audio_processing.h
+++ b/modules/audio_processing/include/audio_processing.h
@@ -283,6 +283,11 @@
} adaptive_digital;
} gain_controller2;
+ // Enables reporting of |output_rms_dbfs| in webrtc::AudioProcessingStats.
+ struct LevelEstimation {
+ bool enabled = false;
+ } level_estimation;
+
// Explicit copy assignment implementation to avoid issues with memory
// sanitizer complaints in case of self-assignment.
// TODO(peah): Add buildflag to ensure that this is only included for memory
diff --git a/modules/audio_processing/include/audio_processing_statistics.h b/modules/audio_processing/include/audio_processing_statistics.h
index 2ff2009..683db05 100644
--- a/modules/audio_processing/include/audio_processing_statistics.h
+++ b/modules/audio_processing/include/audio_processing_statistics.h
@@ -24,6 +24,14 @@
AudioProcessingStats(const AudioProcessingStats& other);
~AudioProcessingStats();
+ // The root mean square (RMS) level in dBFS (decibels from digital
+ // full-scale) of the last capture frame, after processing. It is
+ // constrained to [-127, 0].
+ // The computation follows: https://tools.ietf.org/html/rfc6465
+ // with the intent that it can provide the RTP audio level indication.
+ // Only reported if level estimation is enabled in AudioProcessing::Config.
+ absl::optional<int> output_rms_dbfs;
+
// AEC Statistics.
// ERL = 10log_10(P_far / P_echo)
absl::optional<double> echo_return_loss;