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..adbd744fdcbdffae5d114e331418788e4ce63b07 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,36 @@ AudioOutputManager::~AudioOutputManager() { |
DCHECK(!thread_pool_); |
} |
+void AudioOutputManager::CreateAlsaOutputs() { |
+#if defined(OS_LINUX) |
jeffbrown
2015/11/04 20:33:42
This to me looks like an opportunity to define a n
johngro
2015/11/06 20:22:06
Acknowledged.
We should talk sometime. I'd like
|
+ // 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; } |
+ |
+ audio::AlsaOutput* alsa_out = |
+ static_cast<audio::AlsaOutput*>(audio_out.get()); |
jeffbrown
2015/11/04 20:33:42
Did you "git cl format"? I think this is supposed
johngro
2015/11/06 20:22:06
Done.
Solved this a different way. A long time a
|
+ DCHECK(alsa_out); |
+ |
+ LpcmMediaTypeDetailsPtr config(LpcmMediaTypeDetails::New()); |
+ DCHECK(config); |
jeffbrown
2015/11/04 20:33:42
Might be able to omit this DCHECK. Seems like the
johngro
2015/11/06 20:22:06
The problem here is that this is not a call to ope
|
+ 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 +76,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. |