Commit 34d2626e authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

[Fuchsia] Set input device effects in AudioManagerFuchsia

Currnetly runner always redirects AudioCapturer to the agent and
the AudioCapturer implementation provided by the agent supports echo
cancellation, noise suppression and automatic gain control.
Also, in the future the default AudioCapturer will implement these
effects as well.

Updated AudioManagerFuchsia::GetInputStreamParameters() to report
these effects as supported. This ensures that WebRTC will not try to use
built-in versions of these effects.

Bug: 1065207
Change-Id: I9997dc603544441c0e1bc96516915943e08d7a2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2124305
Auto-Submit: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarDavid Dorwin <ddorwin@chromium.org>
Commit-Queue: David Dorwin <ddorwin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754164}
parent 5283ad46
......@@ -46,12 +46,20 @@ void AudioManagerFuchsia::GetAudioOutputDeviceNames(
AudioParameters AudioManagerFuchsia::GetInputStreamParameters(
const std::string& device_id) {
// TODO(crbug.com/852834): Fuchsia currently doesn't provide an API to get
// device configuration. Update this method when that functionality is
// implemented.
// device configuration and supported effects. Update this method when that
// functionality is implemented.
//
// Use 16kHz sample rate with 10ms buffer, which is consistent with
// the default configuration used in the AudioCapturer implementation.
return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
// Assume that the system-provided AudioConsumer supports echo cancellation,
// noise suppression and automatic gain control.
AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
CHANNEL_LAYOUT_MONO, 16000, 160);
params.set_effects(AudioParameters::ECHO_CANCELLER |
AudioParameters::NOISE_SUPPRESSION |
AudioParameters::AUTOMATIC_GAIN_CONTROL);
return params;
}
AudioParameters AudioManagerFuchsia::GetPreferredOutputStreamParameters(
......
......@@ -69,6 +69,9 @@ void FuchsiaAudioCapturerSource::Initialize(const AudioParameters& params,
capturer_.events().OnPacketProduced =
fit::bind_member(this, &FuchsiaAudioCapturerSource::OnPacketCaptured);
// TODO(crbug.com/1065207): Enable/disable stream processing based on
// |params.effects()| when support is added to fuchsia.media.AudioCapturer.
// Configure stream format.
fuchsia::media::AudioStreamType stream_type;
stream_type.sample_format = fuchsia::media::AudioSampleFormat::FLOAT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment