[go: nahoru, domu]

blob: 1a8f9f8356c286dd38464755eeca156117b870ef [file] [log] [blame]
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module media.mojom;
// Stats from software audio processing in the audio service. Are passed upon
// request from the renderer, see AudioProcessorControls::GetStats() in this
// file.
struct AudioProcessingStats {
// TODO(https://crbug.com/657632): Numeric values cannot 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;
};
// Settings for the software audio processing performed in the audio service.
// The settings are determined in the renderer from media constraints passed by
// JavaScript clients and platform capabilities, and are passed to the audio
// service where the actual processing is applied.
struct AudioProcessingSettings {
bool echo_cancellation;
bool noise_suppression;
bool transient_noise_suppression;
bool automatic_gain_control;
bool high_pass_filter;
bool multi_channel_capture_processing;
bool stereo_mirroring;
bool force_apm_creation;
};
// This interface is hosted in the audio service and called from the renderer.
// It is only used when the audio processing is performed in the audio service.
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);
// Sets a preferred number of capture audio channels. This allows the audio
// processor to avoid unnecessary computational load when the number of input
// audio channels exceeds what is used by the input consumers.
// Values less than 1 and greater than the input stream capacity are adjusted
// to the nearest valid number.
SetPreferredNumCaptureChannels(int32 num_preferred_channels);
};
struct AudioProcessingConfig {
// Used for getting stats and controlling diagnostic audio recordings (AEC
// dumps).
pending_receiver<AudioProcessorControls> controls_receiver;
// Used for determining which kind of audio processing is enabled.
AudioProcessingSettings settings;
};