| Index: services/media/audio/audio_output_manager.cc
|
| diff --git a/services/media/audio/audio_output_manager.cc b/services/media/audio/audio_output_manager.cc
|
| index 59e4ff38a2052c2a748e307355851b6f87412eb3..703d3e7b66ee941b28f97b31a4b9fb7f38d2fdaa 100644
|
| --- a/services/media/audio/audio_output_manager.cc
|
| +++ b/services/media/audio/audio_output_manager.cc
|
| @@ -9,6 +9,9 @@
|
| #include "services/media/audio/audio_server_impl.h"
|
| #include "services/media/audio/audio_track_to_output_link.h"
|
| #include "services/media/audio/platform/generic/throttle_output.h"
|
| +#if defined(OS_LINUX)
|
| +#include "services/media/audio/platform/linux/alsa_output.h"
|
| +#endif
|
|
|
| namespace mojo {
|
| namespace media {
|
| @@ -27,6 +30,34 @@ AudioOutputManager::~AudioOutputManager() {
|
| DCHECK(!thread_pool_);
|
| }
|
|
|
| +void AudioOutputManager::CreateAlsaOutputs() {
|
| +#if defined(OS_LINUX)
|
| + // TODO(johngro): Do better than this. If we really want to support
|
| + // Linux/ALSA as a platform, we should be creating one output for each
|
| + // physical output in the system, matching our configuration to the physical
|
| + // output's configuration, and disabling resampling at the ALSA level.
|
| + //
|
| + // If we could own the output entirely and bypass the mixer to achieve lower
|
| + // latency, that would be even better.
|
| + AudioOutputPtr audio_out(audio::AlsaOutput::New(this));
|
| + if (!audio_out) { return; }
|
| +
|
| + AlsaOutput* alsa_out = static_cast<AlsaOutput*>(audio_out.get());
|
| + DCHECK(alsa_out);
|
| +
|
| + LpcmMediaTypeDetailsPtr config(LpcmMediaTypeDetails::New());
|
| + config->frames_per_second = 48000;
|
| + config->samples_per_frame = 2;
|
| + config->sample_format = LpcmSampleFormat::SIGNED_16;
|
| +
|
| + if (alsa_out->Configure(config.Pass()) != MediaResult::OK) {
|
| + return;
|
| + }
|
| +
|
| + outputs_.emplace(audio_out);
|
| +#endif
|
| +}
|
| +
|
| MediaResult AudioOutputManager::Init() {
|
| // Step #1: Initialize the mixing thread pool.
|
| //
|
| @@ -43,6 +74,7 @@ MediaResult AudioOutputManager::Init() {
|
| // platform. Right now, we just create some hardcoded default outputs and
|
| // leave it at that.
|
| outputs_.emplace(audio::ThrottleOutput::New(this));
|
| + CreateAlsaOutputs();
|
|
|
| // Step #3: Being monitoring for plug/unplug events for pluggable audio
|
| // output devices.
|
|
|