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/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
9 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
10 #include "media/audio/audio_output_dispatcher.h" | 11 #include "media/audio/audio_output_dispatcher_impl.h" |
| 12 #include "media/audio/audio_output_mixer.h" |
11 #include "media/audio/audio_output_proxy.h" | 13 #include "media/audio/audio_output_proxy.h" |
12 #include "media/audio/fake_audio_input_stream.h" | 14 #include "media/audio/fake_audio_input_stream.h" |
13 #include "media/audio/fake_audio_output_stream.h" | 15 #include "media/audio/fake_audio_output_stream.h" |
| 16 #include "media/base/media_switches.h" |
14 | 17 |
15 namespace media { | 18 namespace media { |
16 | 19 |
17 static const int kStreamCloseDelaySeconds = 5; | 20 static const int kStreamCloseDelaySeconds = 5; |
18 | 21 |
19 // Default maximum number of output streams that can be open simultaneously | 22 // Default maximum number of output streams that can be open simultaneously |
20 // for all platforms. | 23 // for all platforms. |
21 static const int kDefaultMaxOutputStreams = 16; | 24 static const int kDefaultMaxOutputStreams = 16; |
22 | 25 |
23 // Default maximum number of input streams that can be open simultaneously | 26 // Default maximum number of input streams that can be open simultaneously |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 132 |
130 return stream; | 133 return stream; |
131 } | 134 } |
132 | 135 |
133 AudioOutputStream* AudioManagerBase::MakeAudioOutputStreamProxy( | 136 AudioOutputStream* AudioManagerBase::MakeAudioOutputStreamProxy( |
134 const AudioParameters& params) { | 137 const AudioParameters& params) { |
135 DCHECK(GetMessageLoop()->BelongsToCurrentThread()); | 138 DCHECK(GetMessageLoop()->BelongsToCurrentThread()); |
136 | 139 |
137 scoped_refptr<AudioOutputDispatcher>& dispatcher = | 140 scoped_refptr<AudioOutputDispatcher>& dispatcher = |
138 output_dispatchers_[params]; | 141 output_dispatchers_[params]; |
139 if (!dispatcher) | 142 if (!dispatcher) { |
140 dispatcher = new AudioOutputDispatcher( | 143 base::TimeDelta close_delay = |
141 this, params, base::TimeDelta::FromSeconds(kStreamCloseDelaySeconds)); | 144 base::TimeDelta::FromSeconds(kStreamCloseDelaySeconds); |
| 145 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 146 if (cmd_line->HasSwitch(switches::kEnableAudioMixer)) { |
| 147 dispatcher = new AudioOutputMixer(this, params, close_delay); |
| 148 } else { |
| 149 dispatcher = new AudioOutputDispatcherImpl(this, params, close_delay); |
| 150 } |
| 151 } |
142 return new AudioOutputProxy(dispatcher); | 152 return new AudioOutputProxy(dispatcher); |
143 } | 153 } |
144 | 154 |
145 bool AudioManagerBase::CanShowAudioInputSettings() { | 155 bool AudioManagerBase::CanShowAudioInputSettings() { |
146 return false; | 156 return false; |
147 } | 157 } |
148 | 158 |
149 void AudioManagerBase::ShowAudioInputSettings() { | 159 void AudioManagerBase::ShowAudioInputSettings() { |
150 } | 160 } |
151 | 161 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 // So, better crash now than later. | 233 // So, better crash now than later. |
224 CHECK(dispatcher->HasOneRef()) << "AudioOutputProxies are still alive"; | 234 CHECK(dispatcher->HasOneRef()) << "AudioOutputProxies are still alive"; |
225 dispatcher = NULL; | 235 dispatcher = NULL; |
226 } | 236 } |
227 } | 237 } |
228 | 238 |
229 output_dispatchers_.clear(); | 239 output_dispatchers_.clear(); |
230 } | 240 } |
231 | 241 |
232 } // namespace media | 242 } // namespace media |
OLD | NEW |