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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
11 #include "media/audio/audio_output_dispatcher_impl.h" | 11 #include "media/audio/audio_output_dispatcher_impl.h" |
12 #include "media/audio/audio_output_mixer.h" | |
13 #include "media/audio/audio_output_proxy.h" | 12 #include "media/audio/audio_output_proxy.h" |
14 #include "media/audio/fake_audio_input_stream.h" | 13 #include "media/audio/fake_audio_input_stream.h" |
15 #include "media/audio/fake_audio_output_stream.h" | 14 #include "media/audio/fake_audio_output_stream.h" |
16 #include "media/base/media_switches.h" | 15 #include "media/base/media_switches.h" |
17 | 16 |
| 17 // TODO(dalecurtis): Temporarily disabled while switching pipeline to use float, |
| 18 // http://crbug.com/114700 |
| 19 #if defined(ENABLE_AUDIO_MIXER) |
| 20 #include "media/audio/audio_output_mixer.h" |
| 21 #endif |
| 22 |
18 namespace media { | 23 namespace media { |
19 | 24 |
20 static const int kStreamCloseDelaySeconds = 5; | 25 static const int kStreamCloseDelaySeconds = 5; |
21 | 26 |
22 // Default maximum number of output streams that can be open simultaneously | 27 // Default maximum number of output streams that can be open simultaneously |
23 // for all platforms. | 28 // for all platforms. |
24 static const int kDefaultMaxOutputStreams = 16; | 29 static const int kDefaultMaxOutputStreams = 16; |
25 | 30 |
26 // Default maximum number of input streams that can be open simultaneously | 31 // Default maximum number of input streams that can be open simultaneously |
27 // for all platforms. | 32 // for all platforms. |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 140 |
136 AudioOutputStream* AudioManagerBase::MakeAudioOutputStreamProxy( | 141 AudioOutputStream* AudioManagerBase::MakeAudioOutputStreamProxy( |
137 const AudioParameters& params) { | 142 const AudioParameters& params) { |
138 DCHECK(GetMessageLoop()->BelongsToCurrentThread()); | 143 DCHECK(GetMessageLoop()->BelongsToCurrentThread()); |
139 | 144 |
140 scoped_refptr<AudioOutputDispatcher>& dispatcher = | 145 scoped_refptr<AudioOutputDispatcher>& dispatcher = |
141 output_dispatchers_[params]; | 146 output_dispatchers_[params]; |
142 if (!dispatcher) { | 147 if (!dispatcher) { |
143 base::TimeDelta close_delay = | 148 base::TimeDelta close_delay = |
144 base::TimeDelta::FromSeconds(kStreamCloseDelaySeconds); | 149 base::TimeDelta::FromSeconds(kStreamCloseDelaySeconds); |
145 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | |
146 // TODO(dalecurtis): Browser side mixing has a couple issues that must be | 150 // TODO(dalecurtis): Browser side mixing has a couple issues that must be |
147 // fixed before it can be turned on by default: http://crbug.com/138098 and | 151 // fixed before it can be turned on by default: http://crbug.com/138098 and |
148 // http://crbug.com/140247 | 152 // http://crbug.com/140247 |
149 if (cmd_line->HasSwitch(switches::kEnableAudioMixer)) { | 153 #if defined(ENABLE_AUDIO_MIXER) |
| 154 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 155 if (cmd_line->HasSwitch(switches::kEnableAudioMixer)) |
150 dispatcher = new AudioOutputMixer(this, params, close_delay); | 156 dispatcher = new AudioOutputMixer(this, params, close_delay); |
151 } else { | 157 else |
| 158 #endif |
152 dispatcher = new AudioOutputDispatcherImpl(this, params, close_delay); | 159 dispatcher = new AudioOutputDispatcherImpl(this, params, close_delay); |
153 } | |
154 } | 160 } |
155 return new AudioOutputProxy(dispatcher); | 161 return new AudioOutputProxy(dispatcher); |
156 } | 162 } |
157 | 163 |
158 bool AudioManagerBase::CanShowAudioInputSettings() { | 164 bool AudioManagerBase::CanShowAudioInputSettings() { |
159 return false; | 165 return false; |
160 } | 166 } |
161 | 167 |
162 void AudioManagerBase::ShowAudioInputSettings() { | 168 void AudioManagerBase::ShowAudioInputSettings() { |
163 } | 169 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // So, better crash now than later. | 242 // So, better crash now than later. |
237 DCHECK(dispatcher->HasOneRef()) << "AudioOutputProxies are still alive"; | 243 DCHECK(dispatcher->HasOneRef()) << "AudioOutputProxies are still alive"; |
238 dispatcher = NULL; | 244 dispatcher = NULL; |
239 } | 245 } |
240 } | 246 } |
241 | 247 |
242 output_dispatchers_.clear(); | 248 output_dispatchers_.clear(); |
243 } | 249 } |
244 | 250 |
245 } // namespace media | 251 } // namespace media |
OLD | NEW |