OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/audio/audio_manager_base.h" | 5 #include "media/audio/audio_manager_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 #if defined(OS_WIN) | 90 #if defined(OS_WIN) |
91 audio_thread_.init_com_with_mta(true); | 91 audio_thread_.init_com_with_mta(true); |
92 #elif defined(OS_MACOSX) | 92 #elif defined(OS_MACOSX) |
93 // CoreAudio calls must occur on the main thread of the process, which in our | 93 // CoreAudio calls must occur on the main thread of the process, which in our |
94 // case is sadly the browser UI thread. Failure to execute calls on the right | 94 // case is sadly the browser UI thread. Failure to execute calls on the right |
95 // thread leads to crashes and odd behavior. See http://crbug.com/158170. | 95 // thread leads to crashes and odd behavior. See http://crbug.com/158170. |
96 // TODO(dalecurtis): We should require the message loop to be passed in. | 96 // TODO(dalecurtis): We should require the message loop to be passed in. |
97 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 97 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
98 if (!cmd_line->HasSwitch(switches::kDisableMainThreadAudio) && | 98 if (!cmd_line->HasSwitch(switches::kDisableMainThreadAudio) && |
99 base::MessageLoopProxy::current().get() && | 99 base::MessageLoopProxy::current().get() && |
100 base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_UI)) { | 100 base::MessageLoopForUI::IsCurrent()) { |
101 task_runner_ = base::MessageLoopProxy::current(); | 101 task_runner_ = base::MessageLoopProxy::current(); |
102 return; | 102 return; |
103 } | 103 } |
104 #endif | 104 #endif |
105 | 105 |
106 CHECK(audio_thread_.Start()); | 106 CHECK(audio_thread_.Start()); |
107 task_runner_ = audio_thread_.message_loop_proxy(); | 107 task_runner_ = audio_thread_.message_loop_proxy(); |
108 } | 108 } |
109 | 109 |
110 AudioManagerBase::~AudioManagerBase() { | 110 AudioManagerBase::~AudioManagerBase() { |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 (*it)->dispatcher->CloseStreamsForWedgeFix(); | 446 (*it)->dispatcher->CloseStreamsForWedgeFix(); |
447 } | 447 } |
448 for (AudioOutputDispatchers::iterator it = output_dispatchers_.begin(); | 448 for (AudioOutputDispatchers::iterator it = output_dispatchers_.begin(); |
449 it != output_dispatchers_.end(); ++it) { | 449 it != output_dispatchers_.end(); ++it) { |
450 (*it)->dispatcher->RestartStreamsForWedgeFix(); | 450 (*it)->dispatcher->RestartStreamsForWedgeFix(); |
451 } | 451 } |
452 #endif | 452 #endif |
453 } | 453 } |
454 | 454 |
455 } // namespace media | 455 } // namespace media |
OLD | NEW |