Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(749)

Unified Diff: media/audio/linux/audio_manager_linux.cc

Issue 7473021: PulseAudio Sound Playback on Linux (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: "New buffering scheme, per offline with vrk" Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/audio/linux/audio_manager_linux.cc
diff --git a/media/audio/linux/audio_manager_linux.cc b/media/audio/linux/audio_manager_linux.cc
index 4d6e2a3b6e26181d27c3a0da7952746e519a23ba..e31e3df89406632389065eedf9537f8976daccf6 100644
--- a/media/audio/linux/audio_manager_linux.cc
+++ b/media/audio/linux/audio_manager_linux.cc
@@ -16,9 +16,13 @@
#include "media/audio/linux/alsa_input.h"
#include "media/audio/linux/alsa_output.h"
#include "media/audio/linux/alsa_wrapper.h"
+#if defined(USE_PULSEAUDIO)
+#include "media/audio/linux/pulse_output.h"
+#endif
#include "media/base/limits.h"
#include "media/base/media_switches.h"
+
// Maximum number of output streams that can be open simultaneously.
static const size_t kMaxOutputStreams = 50;
@@ -99,15 +103,23 @@ AudioOutputStream* AudioManagerLinux::MakeAudioOutputStream(
return NULL;
}
- std::string device_name = AlsaPcmOutputStream::kAutoSelectDevice;
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAlsaOutputDevice)) {
- device_name = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kAlsaOutputDevice);
+ AudioOutputStream* stream;
+#if defined(USE_PULSEAUDIO)
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUsePulseAudio)) {
+ stream = new PulseAudioOutputStream(params, this, GetMessageLoop());
+ } else {
+#endif
+ std::string device_name = AlsaPcmOutputStream::kAutoSelectDevice;
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kAlsaOutputDevice)) {
+ device_name = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kAlsaOutputDevice);
+ }
+ stream = new AlsaPcmOutputStream(device_name, params, wrapper_.get(), this,
+ GetMessageLoop());
+#if defined(USE_PULSEAUDIO)
}
- AlsaPcmOutputStream* stream =
- new AlsaPcmOutputStream(device_name, params, wrapper_.get(), this,
- GetMessageLoop());
+#endif
active_streams_.insert(stream);
return stream;
}
@@ -170,7 +182,7 @@ void AudioManagerLinux::UnMuteAll() {
NOTIMPLEMENTED();
}
-void AudioManagerLinux::ReleaseOutputStream(AlsaPcmOutputStream* stream) {
+void AudioManagerLinux::ReleaseOutputStream(AudioOutputStream* stream) {
if (stream) {
active_streams_.erase(stream);
delete stream;

Powered by Google App Engine
This is Rietveld 408576698