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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 // CoreAudio calls must occur on the main thread of the process, which in our | 88 // CoreAudio calls must occur on the main thread of the process, which in our |
89 // case is sadly the browser UI thread. Failure to execute calls on the right | 89 // case is sadly the browser UI thread. Failure to execute calls on the right |
90 // thread leads to crashes and odd behavior. See http://crbug.com/158170. | 90 // thread leads to crashes and odd behavior. See http://crbug.com/158170. |
91 // TODO(dalecurtis): We should require the message loop to be passed in. | 91 // TODO(dalecurtis): We should require the message loop to be passed in. |
92 if (base::MessageLoopForUI::IsCurrent()) { | 92 if (base::MessageLoopForUI::IsCurrent()) { |
93 task_runner_ = base::MessageLoopProxy::current(); | 93 task_runner_ = base::MessageLoopProxy::current(); |
94 return; | 94 return; |
95 } | 95 } |
96 #endif | 96 #endif |
97 | 97 |
98 #if defined(OS_WIN) | |
99 // We check COM initializer status right after calling this, so wait here | |
DaleCurtis
2015/03/26 00:12:38
Can you elaborate on why this is necessary? CoreAu
DaleCurtis
2015/04/16 16:41:07
Did you have a chance to dig into this further? If
| |
100 // until we finish audio thread initialization (where we also run COM | |
101 // initializer). | |
102 CHECK(audio_thread_.StartAndWait()); | |
103 #else | |
98 CHECK(audio_thread_.Start()); | 104 CHECK(audio_thread_.Start()); |
105 #endif | |
99 task_runner_ = audio_thread_.message_loop_proxy(); | 106 task_runner_ = audio_thread_.message_loop_proxy(); |
100 } | 107 } |
101 | 108 |
102 AudioManagerBase::~AudioManagerBase() { | 109 AudioManagerBase::~AudioManagerBase() { |
103 // The platform specific AudioManager implementation must have already | 110 // The platform specific AudioManager implementation must have already |
104 // stopped the audio thread. Otherwise, we may destroy audio streams before | 111 // stopped the audio thread. Otherwise, we may destroy audio streams before |
105 // stopping the thread, resulting an unexpected behavior. | 112 // stopping the thread, resulting an unexpected behavior. |
106 // This way we make sure activities of the audio streams are all stopped | 113 // This way we make sure activities of the audio streams are all stopped |
107 // before we destroy them. | 114 // before we destroy them. |
108 CHECK(!audio_thread_.IsRunning()); | 115 CHECK(!audio_thread_.IsRunning()); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
398 scoped_ptr<AudioLog> AudioManagerBase::CreateAudioLog( | 405 scoped_ptr<AudioLog> AudioManagerBase::CreateAudioLog( |
399 AudioLogFactory::AudioComponent component) { | 406 AudioLogFactory::AudioComponent component) { |
400 return audio_log_factory_->CreateAudioLog(component); | 407 return audio_log_factory_->CreateAudioLog(component); |
401 } | 408 } |
402 | 409 |
403 void AudioManagerBase::SetHasKeyboardMic() { | 410 void AudioManagerBase::SetHasKeyboardMic() { |
404 NOTREACHED(); | 411 NOTREACHED(); |
405 } | 412 } |
406 | 413 |
407 } // namespace media | 414 } // namespace media |
OLD | NEW |