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