| 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/single_thread_task_runner.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 const DispatcherParams* dispatcher_; | 73 const DispatcherParams* dispatcher_; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 AudioManagerBase::AudioManagerBase(AudioLogFactory* audio_log_factory) | 76 AudioManagerBase::AudioManagerBase(AudioLogFactory* audio_log_factory) |
| 77 : max_num_output_streams_(kDefaultMaxOutputStreams), | 77 : max_num_output_streams_(kDefaultMaxOutputStreams), |
| 78 max_num_input_streams_(kDefaultMaxInputStreams), | 78 max_num_input_streams_(kDefaultMaxInputStreams), |
| 79 num_output_streams_(0), | 79 num_output_streams_(0), |
| 80 num_input_streams_(0), | 80 num_input_streams_(0), |
| 81 // TODO(dalecurtis): Switch this to an ObserverListThreadSafe, so we don't | 81 // TODO(dalecurtis): Switch this to an base::ObserverListThreadSafe, so we |
| 82 // don't |
| 82 // block the UI thread when swapping devices. | 83 // block the UI thread when swapping devices. |
| 83 output_listeners_( | 84 output_listeners_( |
| 84 ObserverList<AudioDeviceListener>::NOTIFY_EXISTING_ONLY), | 85 base::ObserverList<AudioDeviceListener>::NOTIFY_EXISTING_ONLY), |
| 85 audio_thread_("AudioThread"), | 86 audio_thread_("AudioThread"), |
| 86 audio_log_factory_(audio_log_factory) { | 87 audio_log_factory_(audio_log_factory) { |
| 87 #if defined(OS_WIN) | 88 #if defined(OS_WIN) |
| 88 audio_thread_.init_com_with_mta(true); | 89 audio_thread_.init_com_with_mta(true); |
| 89 #elif defined(OS_MACOSX) | 90 #elif defined(OS_MACOSX) |
| 90 // 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 |
| 91 // 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 |
| 92 // 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. |
| 93 // 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. |
| 94 if (base::MessageLoopForUI::IsCurrent()) { | 95 if (base::MessageLoopForUI::IsCurrent()) { |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 scoped_ptr<AudioLog> AudioManagerBase::CreateAudioLog( | 404 scoped_ptr<AudioLog> AudioManagerBase::CreateAudioLog( |
| 404 AudioLogFactory::AudioComponent component) { | 405 AudioLogFactory::AudioComponent component) { |
| 405 return audio_log_factory_->CreateAudioLog(component); | 406 return audio_log_factory_->CreateAudioLog(component); |
| 406 } | 407 } |
| 407 | 408 |
| 408 void AudioManagerBase::SetHasKeyboardMic() { | 409 void AudioManagerBase::SetHasKeyboardMic() { |
| 409 NOTREACHED(); | 410 NOTREACHED(); |
| 410 } | 411 } |
| 411 | 412 |
| 412 } // namespace media | 413 } // namespace media |
| OLD | NEW |