Commit f21a5e78 authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

[Fuchsia] Set AudioRenderer usage

Previously AudioOutputStreamFuchsia wasn't setting stream usage for the
AudioRenderer. The usage is required by the system audio service to make
correct audio policy decisions for the stream. This change updates
AudioOutputStreamFuchsia to SetUsage() appropriately.

Bug: 1065605
Change-Id: If96a9b0713b4acdff63035725b7322d1a5ad65a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2500431
Auto-Submit: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarDavid Dorwin <ddorwin@chromium.org>
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821483}
parent ecb93f4d
...@@ -17,12 +17,23 @@ ...@@ -17,12 +17,23 @@
namespace media { namespace media {
namespace {
// Current AudioRenderer implementation allows only one buffer with id=0. // Current AudioRenderer implementation allows only one buffer with id=0.
// TODO(crbug.com/1131179): Replace with an incrementing buffer id now that // TODO(crbug.com/1131179): Replace with an incrementing buffer id now that
// AddPayloadBuffer() and RemovePayloadBuffer() are implemented properly in // AddPayloadBuffer() and RemovePayloadBuffer() are implemented properly in
// AudioRenderer. // AudioRenderer.
const uint32_t kBufferId = 0; const uint32_t kBufferId = 0;
fuchsia::media::AudioRenderUsage GetStreamUsage(
const AudioParameters& parameters) {
if (parameters.latency_tag() == AudioLatency::LATENCY_RTC)
return fuchsia::media::AudioRenderUsage::COMMUNICATION;
return fuchsia::media::AudioRenderUsage::MEDIA;
}
} // namespace
AudioOutputStreamFuchsia::AudioOutputStreamFuchsia( AudioOutputStreamFuchsia::AudioOutputStreamFuchsia(
AudioManagerFuchsia* manager, AudioManagerFuchsia* manager,
const AudioParameters& parameters) const AudioParameters& parameters)
...@@ -47,6 +58,8 @@ bool AudioOutputStreamFuchsia::Open() { ...@@ -47,6 +58,8 @@ bool AudioOutputStreamFuchsia::Open() {
audio_renderer_.set_error_handler( audio_renderer_.set_error_handler(
fit::bind_member(this, &AudioOutputStreamFuchsia::OnRendererError)); fit::bind_member(this, &AudioOutputStreamFuchsia::OnRendererError));
audio_renderer_->SetUsage(GetStreamUsage(parameters_));
// Inform the |audio_renderer_| of the format required by the caller. // Inform the |audio_renderer_| of the format required by the caller.
fuchsia::media::AudioStreamType format; fuchsia::media::AudioStreamType format;
format.sample_format = fuchsia::media::AudioSampleFormat::FLOAT; format.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