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

Unified Diff: content/browser/browser_main_loop.cc

Issue 1806313003: Pass task runners to AudioManager constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass task runners into AudioManager::Create Created 4 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 | « no previous file | media/audio/BUILD.gn » ('j') | media/audio/audio_input_controller_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_main_loop.cc
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 91fec92c1f173700098640a212dfd70ec612aaa5..b3b14003fd72a049a36aa18a3e27699a57b6a627 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -1046,6 +1046,9 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
#endif
#endif // !defined(OS_IOS)
+ // Destroy audio_manager_ on audio thread.
DaleCurtis 2016/03/18 17:48:18 Be careful here, this changes the destruction orde
alokp 2016/03/18 18:40:06 Yeah I need to cycle this through the trybots.
+ AudioManager::Destroy(audio_manager_.release());
+
// Shutdown Mojo shell and IPC.
#if !defined(OS_IOS)
mojo_shell_context_.reset();
@@ -1256,8 +1259,24 @@ int BrowserMainLoop::BrowserThreadsStarted() {
{
TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:AudioMan");
- audio_manager_.reset(media::AudioManager::CreateWithHangTimer(
- MediaInternals::GetInstance(), io_thread_->task_runner()));
+ scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner;
DaleCurtis 2016/03/18 17:48:18 What will this code look like for cast?
alokp 2016/03/18 18:40:06 Since BML is common for all platforms/content-embe
+ scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner;
+ scoped_refptr<base::SingleThreadTaskRunner> monitor_task_runner;
+ AudioLogFactory* audio_log_factory = MediaInternals::GetInstance();
+#if defined(OS_MACOSX)
+ // CoreAudio calls must occur on the main thread of the process, which in
+ // our case is sadly the browser UI thread. Failure to execute calls on the
+ // right thread leads to crashes and odd behavior.
+ // See http://crbug.com/158170.
+ // Since the audio thread is the UI thread, a hang monitor is not
+ // necessary or recommended.
+ audio_task_runner = base::ThreadTaskRunnerHandle::Get();
+#else
+ monitor_task_runner = io_thread_->task_runner();
+#endif
+ audio_manager_.reset(
+ media::AudioManager::Create(audio_task_runner, worker_task_runner,
+ monitor_task_runner, audio_log_factory));
}
{
« no previous file with comments | « no previous file | media/audio/BUILD.gn » ('j') | media/audio/audio_input_controller_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698