diff options
Diffstat (limited to 'media/audio/linux/audio_manager_linux.cc')
-rw-r--r-- | media/audio/linux/audio_manager_linux.cc | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/media/audio/linux/audio_manager_linux.cc b/media/audio/linux/audio_manager_linux.cc index 17a1f74..713a753 100644 --- a/media/audio/linux/audio_manager_linux.cc +++ b/media/audio/linux/audio_manager_linux.cc @@ -4,7 +4,6 @@ #include "media/audio/linux/audio_manager_linux.h" -#include "base/at_exit.h" #include "base/command_line.h" #include "base/logging.h" #include "media/audio/fake_audio_input_stream.h" @@ -13,12 +12,6 @@ #include "media/audio/linux/alsa_wrapper.h" #include "media/base/media_switches.h" - -namespace { - -AudioManagerLinux* g_audio_manager = NULL; -} // namespace - // Implementation of AudioManager. bool AudioManagerLinux::HasAudioOutputDevices() { // TODO(ajwong): Make this actually query audio devices. @@ -56,7 +49,7 @@ AudioOutputStream* AudioManagerLinux::MakeAudioOutputStream( return FakeAudioOutputStream::MakeFakeStream(); } - if (!initialized_) { + if (!initialized()) { return NULL; } @@ -68,16 +61,14 @@ AudioOutputStream* AudioManagerLinux::MakeAudioOutputStream( AlsaPcmOutputStream* stream = new AlsaPcmOutputStream(device_name, format, channels, sample_rate, bits_per_sample, wrapper_.get(), this, - audio_thread_.message_loop()); + GetMessageLoop()); AutoLock l(lock_); active_streams_[stream] = scoped_refptr<AlsaPcmOutputStream>(stream); return stream; } -AudioManagerLinux::AudioManagerLinux() - : audio_thread_("AudioThread"), - initialized_(false) { +AudioManagerLinux::AudioManagerLinux() { } AudioManagerLinux::~AudioManagerLinux() { @@ -91,7 +82,7 @@ AudioManagerLinux::~AudioManagerLinux() { } void AudioManagerLinux::Init() { - initialized_ = audio_thread_.Start(); + AudioManagerBase::Init(); wrapper_.reset(new AlsaWrapper()); } @@ -110,17 +101,7 @@ void AudioManagerLinux::ReleaseOutputStream(AlsaPcmOutputStream* stream) { } } -// TODO(ajwong): Collapse this with the windows version. -void DestroyAudioManagerLinux(void* not_used) { - delete g_audio_manager; - g_audio_manager = NULL; -} - -AudioManager* AudioManager::GetAudioManager() { - if (!g_audio_manager) { - g_audio_manager = new AudioManagerLinux(); - g_audio_manager->Init(); - base::AtExitManager::RegisterCallback(&DestroyAudioManagerLinux, NULL); - } - return g_audio_manager; +// static +AudioManager* AudioManager::CreateAudioManager() { + return new AudioManagerLinux(); } |