[go: nahoru, domu]

blob: 1a8f9f8356c286dd38464755eeca156117b870ef [file] [log] [blame]
Avi Drissmand387f0922022-09-14 20:51:311// Copyright 2022 The Chromium Authors
Thomas Guilberta3e0d572022-02-08 19:26:422// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5module media.mojom;
6
Sam Zackrisson0ed23812022-02-23 11:43:237// Stats from software audio processing in the audio service. Are passed upon
8// request from the renderer, see AudioProcessorControls::GetStats() in this
9// file.
10struct AudioProcessingStats {
11
12 // TODO(https://crbug.com/657632): Numeric values cannot be optional, so add
13 // flags for each of them.
14 bool has_echo_return_loss;
15 double echo_return_loss;
16
17 bool has_echo_return_loss_enhancement;
18 double echo_return_loss_enhancement;
19};
Thomas Guilberta3e0d572022-02-08 19:26:4220
21// Settings for the software audio processing performed in the audio service.
22// The settings are determined in the renderer from media constraints passed by
23// JavaScript clients and platform capabilities, and are passed to the audio
24// service where the actual processing is applied.
25struct AudioProcessingSettings {
26 bool echo_cancellation;
27 bool noise_suppression;
28 bool transient_noise_suppression;
29 bool automatic_gain_control;
Thomas Guilberta3e0d572022-02-08 19:26:4230 bool high_pass_filter;
31 bool multi_channel_capture_processing;
32 bool stereo_mirroring;
33 bool force_apm_creation;
34};
35
36// This interface is hosted in the audio service and called from the renderer.
Sam Zackrisson0ed23812022-02-23 11:43:2337// It is only used when the audio processing is performed in the audio service.
Thomas Guilberta3e0d572022-02-08 19:26:4238interface AudioProcessorControls {
Sam Zackrisson0ed23812022-02-23 11:43:2339
40 // Request the latest stats from the audio processor. At the farthest level,
41 // this is triggered by calls from JavaScript, through some levels of
42 // indirection. (See: https://www.w3.org/TR/webrtc-stats/). Since there are no
43 // guarantees in the standard about the rate at which stats change, it is
44 // reasonable to let multiple user-facing calls result in just one call to
45 // this function.
46 GetStats() => (AudioProcessingStats stats);
47
48 // Sets a preferred number of capture audio channels. This allows the audio
49 // processor to avoid unnecessary computational load when the number of input
50 // audio channels exceeds what is used by the input consumers.
51 // Values less than 1 and greater than the input stream capacity are adjusted
52 // to the nearest valid number.
53 SetPreferredNumCaptureChannels(int32 num_preferred_channels);
Thomas Guilberta3e0d572022-02-08 19:26:4254};
55
56struct AudioProcessingConfig {
57 // Used for getting stats and controlling diagnostic audio recordings (AEC
58 // dumps).
59 pending_receiver<AudioProcessorControls> controls_receiver;
60
61 // Used for determining which kind of audio processing is enabled.
62 AudioProcessingSettings settings;
63};