Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1928)

Unified Diff: content/renderer/media/media_stream_audio_processor_options.cc

Issue 2540703002: Use the new statics interface to get APM stats from WebRTC (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/media_stream_audio_processor_options.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/media_stream_audio_processor_options.cc
diff --git a/content/renderer/media/media_stream_audio_processor_options.cc b/content/renderer/media/media_stream_audio_processor_options.cc
index 421643a94febaf95c4e6dfcbc66504a77636d69c..7c1c929d251612d8e6e3b5967887bb2b148b14ee 100644
--- a/content/renderer/media/media_stream_audio_processor_options.cc
+++ b/content/renderer/media/media_stream_audio_processor_options.cc
@@ -480,47 +480,21 @@ void EnableAutomaticGainControl(AudioProcessing* audio_processing) {
CHECK_EQ(err, 0);
}
-void GetAecStats(webrtc::EchoCancellation* echo_cancellation,
- webrtc::AudioProcessorInterface::AudioProcessorStats* stats) {
- // These values can take on valid negative values, so use the lowest possible
- // level as default rather than -1.
- stats->echo_return_loss = -100;
- stats->echo_return_loss_enhancement = -100;
-
- // The median value can also be negative, but in practice -1 is only used to
- // signal insufficient data, since the resolution is limited to multiples
- // of 4ms.
- stats->echo_delay_median_ms = -1;
- stats->echo_delay_std_ms = -1;
-
- // TODO(ajm): Re-enable this metric once we have a reliable implementation.
- stats->aec_quality_min = -1.0f;
-
- if (!echo_cancellation->are_metrics_enabled() ||
- !echo_cancellation->is_delay_logging_enabled() ||
- !echo_cancellation->is_enabled()) {
- return;
- }
-
- // TODO(ajm): we may want to use VoECallReport::GetEchoMetricsSummary
- // here, but it appears to be unsuitable currently. Revisit after this is
- // investigated: http://b/issue?id=5666755
- webrtc::EchoCancellation::Metrics echo_metrics;
- if (!echo_cancellation->GetMetrics(&echo_metrics)) {
- stats->echo_return_loss = echo_metrics.echo_return_loss.instant;
- stats->echo_return_loss_enhancement =
- echo_metrics.echo_return_loss_enhancement.instant;
- stats->aec_divergent_filter_fraction =
- echo_metrics.divergent_filter_fraction;
- }
-
- int median = 0, std = 0;
- float dummy = 0;
- if (echo_cancellation->GetDelayMetrics(&median, &std, &dummy) ==
- webrtc::AudioProcessing::kNoError) {
- stats->echo_delay_median_ms = median;
- stats->echo_delay_std_ms = std;
- }
+void GetAudioProcessingStats(
+ AudioProcessing* audio_processing,
+ webrtc::AudioProcessorInterface::AudioProcessorStats* stats) {
+ // TODO(ivoc): Change the APM stats to use rtc::Optional instead of default
+ // values.
+ auto apm_stats = audio_processing->GetStatistics();
+ stats->echo_return_loss = apm_stats.echo_return_loss.instant();
+ stats->echo_return_loss_enhancement =
+ apm_stats.echo_return_loss_enhancement.instant();
+ stats->aec_divergent_filter_fraction = apm_stats.divergent_filter_fraction;
+
+ stats->echo_delay_median_ms = apm_stats.delay_median;
+ stats->echo_delay_std_ms = apm_stats.delay_standard_deviation;
+
+ stats->residual_echo_likelihood = apm_stats.residual_echo_likelihood;
}
std::vector<webrtc::Point> GetArrayGeometryPreferringConstraints(
« no previous file with comments | « content/renderer/media/media_stream_audio_processor_options.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698