| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "media/audio/audio_output_dispatcher.h" |
| 7 #include "media/audio/audio_output_proxy.h" |
| 8 |
| 9 namespace { |
| 10 const int kStreamCloseDelayMs = 5000; |
| 11 } // namespace |
| 6 | 12 |
| 7 AudioManagerBase::AudioManagerBase() | 13 AudioManagerBase::AudioManagerBase() |
| 8 : audio_thread_("AudioThread"), | 14 : audio_thread_("AudioThread"), |
| 9 initialized_(false) { | 15 initialized_(false) { |
| 10 } | 16 } |
| 11 | 17 |
| 18 AudioManagerBase::~AudioManagerBase() { |
| 19 } |
| 20 |
| 12 void AudioManagerBase::Init() { | 21 void AudioManagerBase::Init() { |
| 13 initialized_ = audio_thread_.Start(); | 22 initialized_ = audio_thread_.Start(); |
| 14 } | 23 } |
| 15 | 24 |
| 16 string16 AudioManagerBase::GetAudioInputDeviceModel() { | 25 string16 AudioManagerBase::GetAudioInputDeviceModel() { |
| 17 return string16(); | 26 return string16(); |
| 18 } | 27 } |
| 19 | 28 |
| 20 MessageLoop* AudioManagerBase::GetMessageLoop() { | 29 MessageLoop* AudioManagerBase::GetMessageLoop() { |
| 21 DCHECK(initialized_); | 30 DCHECK(initialized_); |
| 22 return audio_thread_.message_loop(); | 31 return audio_thread_.message_loop(); |
| 23 } | 32 } |
| 33 |
| 34 AudioOutputStream* AudioManagerBase::MakeAudioOutputStreamProxy( |
| 35 const AudioParameters& params) { |
| 36 if (!initialized_) |
| 37 return NULL; |
| 38 |
| 39 scoped_refptr<AudioOutputDispatcher>& dispatcher = |
| 40 output_dispatchers_[params]; |
| 41 if (!dispatcher) |
| 42 dispatcher = new AudioOutputDispatcher(this, params, kStreamCloseDelayMs); |
| 43 |
| 44 return new AudioOutputProxy(dispatcher); |
| 45 } |
| OLD | NEW |