Chromium Code Reviews| Index: media/audio/pulse/audio_manager_pulse.cc |
| diff --git a/media/audio/pulse/audio_manager_pulse.cc b/media/audio/pulse/audio_manager_pulse.cc |
| index d6e9543183a0f86c8130b1459f8cd6a65e54ef2d..b96728c73c4cbb41f6dbf6ef1052d57405e5a75e 100644 |
| --- a/media/audio/pulse/audio_manager_pulse.cc |
| +++ b/media/audio/pulse/audio_manager_pulse.cc |
| @@ -47,18 +47,13 @@ static const base::FilePath::CharType kPulseLib[] = |
| FILE_PATH_LITERAL("libpulse.so.0"); |
| #endif |
| -// static |
| -AudioManager* AudioManagerPulse::Create(AudioLogFactory* audio_log_factory) { |
| - scoped_ptr<AudioManagerPulse> ret(new AudioManagerPulse(audio_log_factory)); |
| - if (ret->Init()) |
| - return ret.release(); |
| - |
| - DVLOG(1) << "PulseAudio is not available on the OS"; |
| - return NULL; |
| -} |
| - |
| -AudioManagerPulse::AudioManagerPulse(AudioLogFactory* audio_log_factory) |
| - : AudioManagerBase(audio_log_factory), |
| +AudioManagerPulse::AudioManagerPulse( |
| + scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| + scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, |
| + AudioLogFactory* audio_log_factory) |
| + : AudioManagerBase(std::move(task_runner), |
| + std::move(worker_task_runner), |
| + audio_log_factory), |
| input_mainloop_(NULL), |
| input_context_(NULL), |
| devices_(NULL), |
| @@ -68,12 +63,20 @@ AudioManagerPulse::AudioManagerPulse(AudioLogFactory* audio_log_factory) |
| AudioManagerPulse::~AudioManagerPulse() { |
| Shutdown(); |
| - |
| // The Pulse objects are the last things to be destroyed since Shutdown() |
| // needs them. |
| DestroyPulse(); |
| } |
| +bool AudioManagerPulse::Init() { |
|
DaleCurtis
2016/04/14 00:00:35
What's the point of this change? Why not just merg
|
| + // TODO(alokp): Investigate if InitPulse can happen on the audio thread. |
| + // It currently needs to happen on the main thread so that is InitPulse fails, |
| + // we can fallback to ALSA implementation. Initializing it on audio thread |
| + // would unblock the main thread and make InitPulse consistent with |
| + // DestroyPulse which happens on the audio thread. |
| + return InitPulse(); |
| +} |
| + |
| // Implementation of AudioManager. |
| bool AudioManagerPulse::HasAudioOutputDevices() { |
| AudioDeviceNames devices; |
| @@ -217,7 +220,7 @@ int AudioManagerPulse::GetNativeSampleRate() { |
| return native_input_sample_rate_; |
| } |
| -bool AudioManagerPulse::Init() { |
| +bool AudioManagerPulse::InitPulse() { |
| DCHECK(!input_mainloop_); |
| #if defined(DLOPEN_PULSEAUDIO) |