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/single_thread_task_runner.h" | |
11 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
12 #include "base/thread_task_runner_handle.h" | |
13 #include "build/build_config.h" | 11 #include "build/build_config.h" |
14 #include "media/audio/audio_output_dispatcher_impl.h" | 12 #include "media/audio/audio_output_dispatcher_impl.h" |
15 #include "media/audio/audio_output_proxy.h" | 13 #include "media/audio/audio_output_proxy.h" |
16 #include "media/audio/audio_output_resampler.h" | 14 #include "media/audio/audio_output_resampler.h" |
17 #include "media/audio/fake_audio_input_stream.h" | 15 #include "media/audio/fake_audio_input_stream.h" |
18 #include "media/audio/fake_audio_output_stream.h" | 16 #include "media/audio/fake_audio_output_stream.h" |
19 #include "media/base/media_switches.h" | 17 #include "media/base/media_switches.h" |
20 | 18 |
21 namespace media { | 19 namespace media { |
22 | 20 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // Do not use MTA mode initalization as it causes hangs for a significant | 86 // Do not use MTA mode initalization as it causes hangs for a significant |
89 // population of users and is not supported on Windows 8 for audio capture | 87 // population of users and is not supported on Windows 8 for audio capture |
90 // and rendering. See http://crbug.com/422522. | 88 // and rendering. See http://crbug.com/422522. |
91 audio_thread_.init_com_with_mta(false); | 89 audio_thread_.init_com_with_mta(false); |
92 #elif defined(OS_MACOSX) | 90 #elif defined(OS_MACOSX) |
93 // CoreAudio calls must occur on the main thread of the process, which in our | 91 // 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 | 92 // 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. | 93 // 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. | 94 // TODO(dalecurtis): We should require the message loop to be passed in. |
97 if (base::MessageLoopForUI::IsCurrent()) { | 95 if (base::MessageLoopForUI::IsCurrent()) { |
98 task_runner_ = base::ThreadTaskRunnerHandle::Get(); | 96 task_runner_ = base::MessageLoopProxy::current(); |
99 return; | 97 return; |
100 } | 98 } |
101 #endif | 99 #endif |
102 | 100 |
103 CHECK(audio_thread_.Start()); | 101 CHECK(audio_thread_.Start()); |
104 task_runner_ = audio_thread_.message_loop_proxy(); | 102 task_runner_ = audio_thread_.message_loop_proxy(); |
105 } | 103 } |
106 | 104 |
107 AudioManagerBase::~AudioManagerBase() { | 105 AudioManagerBase::~AudioManagerBase() { |
108 // The platform specific AudioManager implementation must have already | 106 // The platform specific AudioManager implementation must have already |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 scoped_ptr<AudioLog> AudioManagerBase::CreateAudioLog( | 401 scoped_ptr<AudioLog> AudioManagerBase::CreateAudioLog( |
404 AudioLogFactory::AudioComponent component) { | 402 AudioLogFactory::AudioComponent component) { |
405 return audio_log_factory_->CreateAudioLog(component); | 403 return audio_log_factory_->CreateAudioLog(component); |
406 } | 404 } |
407 | 405 |
408 void AudioManagerBase::SetHasKeyboardMic() { | 406 void AudioManagerBase::SetHasKeyboardMic() { |
409 NOTREACHED(); | 407 NOTREACHED(); |
410 } | 408 } |
411 | 409 |
412 } // namespace media | 410 } // namespace media |
OLD | NEW |