// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. module audio.mojom; import "mojo/public/mojom/base/file.mojom"; import "mojo/public/mojom/base/time.mojom"; import "mojo/public/mojom/base/unguessable_token.mojom"; struct AudioProcessingStats { bool typing_noise_detected; // (https://crbug.com/657632) Numeric values can't be optional, so add flags // for each of them. bool has_echo_return_loss; double echo_return_loss; bool has_echo_return_loss_enhancement; double echo_return_loss_enhancement; bool has_divergent_filter_fraction; double divergent_filter_fraction; bool has_delay_median_ms; int32 delay_median_ms; bool has_delay_standard_deviation_ms; int32 delay_standard_deviation_ms; bool has_residual_echo_likelihood; double residual_echo_likelihood; bool has_residual_echo_likelihood_recent_max; double residual_echo_likelihood_recent_max; bool has_delay_ms; int32 delay_ms; }; enum AutomaticGainControlType { kDisabled, kDefault, kExperimental, kHybridExperimental }; enum EchoCancellationType { kDisabled, kAec2, kAec3, kSystemAec }; enum NoiseSuppressionType { kDisabled, kDefault, kExperimental }; struct AudioProcessingSettings { EchoCancellationType echo_cancellation; NoiseSuppressionType noise_suppression; AutomaticGainControlType automatic_gain_control; bool high_pass_filter; bool typing_detection; bool stereo_mirroring; }; // This interface is hosted in the audio service and called from the renderer. // It is only used when running the audio service out of process. interface AudioProcessorControls { // Request the latest stats from the audio processor. At the farthest level, // this is triggered by calls from JavaScript, through some levels of // indirection. (See: https://www.w3.org/TR/webrtc-stats/). Since there are no // guarantees in the standard about the rate at which stats change, it is // reasonable to let multiple user-facing calls result in just one call to // this function. GetStats() => (AudioProcessingStats stats); // Begin dumping echo cancellation data into |file|. AEC dumps can be // initiated by the user and then be used to track audio quality issues before // and after audio processing. StartEchoCancellationDump(mojo_base.mojom.File file); // Stop any ongoing dump of echo cancellation data. StopEchoCancellationDump(); }; struct AudioProcessingConfig { // Used for getting stats and controlling AEC dumps. AudioProcessorControls& controls_request; // Used for connecting streams to the audio processor. mojo_base.mojom.UnguessableToken processing_id; // Used for determining which kind of audio processing is enabled. AudioProcessingSettings settings; };