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..4bc9a4a590db07983c8d78739374c62cc01e55f5 100644 |
--- a/content/browser/browser_main_loop.cc |
+++ b/content/browser/browser_main_loop.cc |
@@ -73,7 +73,6 @@ |
#include "content/public/common/result_codes.h" |
#include "device/battery/battery_status_service.h" |
#include "ipc/mojo/scoped_ipc_support.h" |
-#include "media/audio/audio_manager.h" |
#include "media/base/media.h" |
#include "media/base/user_input_monitor.h" |
#include "media/midi/midi_manager.h" |
@@ -1256,8 +1255,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; |
+ scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner; |
+ scoped_refptr<base::SingleThreadTaskRunner> monitor_task_runner; |
+ media::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_ = |
+ media::AudioManager::Create(audio_task_runner, worker_task_runner, |
tommi (sloooow) - chröme
2016/03/19 02:32:41
nit: since these are going out of scope and Create
alokp
2016/03/22 21:47:06
I think we need to pass the ownership to match the
|
+ monitor_task_runner, audio_log_factory); |
} |
{ |