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

Unified Diff: media/audio/openbsd/audio_manager_openbsd.cc

Issue 12310101: Enable pulse as the default IO handling in Chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added UMA histogram Created 7 years, 9 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
« no previous file with comments | « media/audio/openbsd/audio_manager_openbsd.h ('k') | media/base/media_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/openbsd/audio_manager_openbsd.cc
diff --git a/media/audio/openbsd/audio_manager_openbsd.cc b/media/audio/openbsd/audio_manager_openbsd.cc
index fd74df530a2bdd396fab11991f0219f8496a50ae..681f2194d2efc0147b0c3aa779e7178fb718721e 100644
--- a/media/audio/openbsd/audio_manager_openbsd.cc
+++ b/media/audio/openbsd/audio_manager_openbsd.cc
@@ -4,19 +4,23 @@
#include "media/audio/openbsd/audio_manager_openbsd.h"
+#include <fcntl.h>
+
#include "base/command_line.h"
+#include "base/file_path.h"
#include "base/stl_util.h"
#include "media/audio/audio_output_dispatcher.h"
#include "media/audio/audio_parameters.h"
#include "media/audio/audio_util.h"
-#if defined(USE_PULSEAUDIO)
#include "media/audio/pulse/pulse_output.h"
-#endif
+#include "media/audio/pulse/pulse_stubs.h"
#include "media/base/channel_layout.h"
#include "media/base/limits.h"
#include "media/base/media_switches.h"
-#include <fcntl.h>
+using media_audio_pulse::kModulePulse;
+using media_audio_pulse::InitializeStubs;
+using media_audio_pulse::StubPathMap;
namespace media {
@@ -26,6 +30,9 @@ static const int kMaxOutputStreams = 50;
// Default sample rate for input and output streams.
static const int kDefaultSampleRate = 48000;
+static const base::FilePath::CharType kPulseLib[] =
+ FILE_PATH_LITERAL("libpulse.so.0");
+
// Implementation of AudioManager.
static bool HasAudioHardware() {
int fd;
@@ -58,8 +65,19 @@ AudioParameters AudioManagerOpenBSD::GetInputStreamParameters(
kDefaultSampleRate, 16, kDefaultInputBufferSize);
}
-AudioManagerOpenBSD::AudioManagerOpenBSD() {
+AudioManagerOpenBSD::AudioManagerOpenBSD()
+ : pulse_library_is_initialized_(false) {
SetMaxOutputStreamsAllowed(kMaxOutputStreams);
+ StubPathMap paths;
+
+ // Check if the pulse library is avialbale.
+ paths[kModulePulse].push_back(kPulseLib);
+ if (!InitializeStubs(paths)) {
+ DLOG(WARNING) << "Failed on loading the Pulse library and symbols";
+ return;
+ }
+
+ pulse_library_is_initialized_ = true;
}
AudioManagerOpenBSD::~AudioManagerOpenBSD() {
@@ -118,16 +136,11 @@ AudioParameters AudioManagerOpenBSD::GetPreferredOutputStreamParameters(
sample_rate, bits_per_sample, buffer_size);
}
-
AudioOutputStream* AudioManagerOpenBSD::MakeOutputStream(
const AudioParameters& params) {
-#if defined(USE_PULSEAUDIO)
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUsePulseAudio)) {
+ if (pulse_library_is_initialized_)
return new PulseAudioOutputStream(params, this);
- }
-#endif
- NOTIMPLEMENTED();
return NULL;
}
« no previous file with comments | « media/audio/openbsd/audio_manager_openbsd.h ('k') | media/base/media_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698