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

Unified Diff: media/audio/pulse/audio_manager_pulse.cc

Issue 1901583005: Revert of Pass task runners to AudioManager constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/pulse/audio_manager_pulse.h ('k') | media/audio/sounds/audio_stream_handler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b96728c73c4cbb41f6dbf6ef1052d57405e5a75e..d6e9543183a0f86c8130b1459f8cd6a65e54ef2d 100644
--- a/media/audio/pulse/audio_manager_pulse.cc
+++ b/media/audio/pulse/audio_manager_pulse.cc
@@ -47,13 +47,18 @@
FILE_PATH_LITERAL("libpulse.so.0");
#endif
-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),
+// 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),
input_mainloop_(NULL),
input_context_(NULL),
devices_(NULL),
@@ -63,18 +68,10 @@
AudioManagerPulse::~AudioManagerPulse() {
Shutdown();
+
// The Pulse objects are the last things to be destroyed since Shutdown()
// needs them.
DestroyPulse();
-}
-
-bool AudioManagerPulse::Init() {
- // 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.
@@ -220,7 +217,7 @@
return native_input_sample_rate_;
}
-bool AudioManagerPulse::InitPulse() {
+bool AudioManagerPulse::Init() {
DCHECK(!input_mainloop_);
#if defined(DLOPEN_PULSEAUDIO)
« no previous file with comments | « media/audio/pulse/audio_manager_pulse.h ('k') | media/audio/sounds/audio_stream_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698