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 |
| 100 // until we finish audio thread initialization (where we also run COM |
| 101 // initializer). |
| 102 // CHECK(audio_thread_.StartAndWait()); |
| 103 CHECK(audio_thread_.Start()); // XXX for testing |
| 104 #else |
98 CHECK(audio_thread_.Start()); | 105 CHECK(audio_thread_.Start()); |
| 106 #endif |
99 task_runner_ = audio_thread_.message_loop_proxy(); | 107 task_runner_ = audio_thread_.message_loop_proxy(); |
100 } | 108 } |
101 | 109 |
102 AudioManagerBase::~AudioManagerBase() { | 110 AudioManagerBase::~AudioManagerBase() { |
103 // The platform specific AudioManager implementation must have already | 111 // The platform specific AudioManager implementation must have already |
104 // stopped the audio thread. Otherwise, we may destroy audio streams before | 112 // stopped the audio thread. Otherwise, we may destroy audio streams before |
105 // stopping the thread, resulting an unexpected behavior. | 113 // stopping the thread, resulting an unexpected behavior. |
106 // This way we make sure activities of the audio streams are all stopped | 114 // This way we make sure activities of the audio streams are all stopped |
107 // before we destroy them. | 115 // before we destroy them. |
108 CHECK(!audio_thread_.IsRunning()); | 116 CHECK(!audio_thread_.IsRunning()); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 scoped_ptr<AudioLog> AudioManagerBase::CreateAudioLog( | 406 scoped_ptr<AudioLog> AudioManagerBase::CreateAudioLog( |
399 AudioLogFactory::AudioComponent component) { | 407 AudioLogFactory::AudioComponent component) { |
400 return audio_log_factory_->CreateAudioLog(component); | 408 return audio_log_factory_->CreateAudioLog(component); |
401 } | 409 } |
402 | 410 |
403 void AudioManagerBase::SetHasKeyboardMic() { | 411 void AudioManagerBase::SetHasKeyboardMic() { |
404 NOTREACHED(); | 412 NOTREACHED(); |
405 } | 413 } |
406 | 414 |
407 } // namespace media | 415 } // namespace media |
OLD | NEW |