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/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
11 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
12 #include "media/audio/audio_output_dispatcher_impl.h" | 12 #include "media/audio/audio_output_dispatcher_impl.h" |
13 #include "media/audio/audio_output_proxy.h" | 13 #include "media/audio/audio_output_proxy.h" |
14 #include "media/audio/audio_output_resampler.h" | 14 #include "media/audio/audio_output_resampler.h" |
15 #include "media/audio/audio_util.h" | 15 #include "media/audio/audio_util.h" |
16 #include "media/audio/fake_audio_input_stream.h" | 16 #include "media/audio/fake_audio_input_stream.h" |
17 #include "media/audio/fake_audio_output_stream.h" | 17 #include "media/audio/fake_audio_output_stream.h" |
18 #include "media/audio/virtual_audio_input_stream.h" | 18 #include "media/audio/virtual_audio_input_stream.h" |
19 #include "media/audio/virtual_audio_output_stream.h" | 19 #include "media/audio/virtual_audio_output_stream.h" |
20 #include "media/base/media_switches.h" | 20 #include "media/base/media_switches.h" |
21 | 21 |
22 // TODO(dalecurtis): Temporarily disabled while switching pipeline to use float, | |
23 // http://crbug.com/114700 | |
24 #if defined(ENABLE_AUDIO_MIXER) | |
25 #include "media/audio/audio_output_mixer.h" | |
26 #endif | |
27 | |
28 namespace media { | 22 namespace media { |
29 | 23 |
30 static const int kStreamCloseDelaySeconds = 5; | 24 static const int kStreamCloseDelaySeconds = 5; |
31 | 25 |
32 // Default maximum number of output streams that can be open simultaneously | 26 // Default maximum number of output streams that can be open simultaneously |
33 // for all platforms. | 27 // for all platforms. |
34 static const int kDefaultMaxOutputStreams = 16; | 28 static const int kDefaultMaxOutputStreams = 16; |
35 | 29 |
36 // Default maximum number of input streams that can be open simultaneously | 30 // Default maximum number of input streams that can be open simultaneously |
37 // for all platforms. | 31 // for all platforms. |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 base::TimeDelta::FromSeconds(kStreamCloseDelaySeconds); | 259 base::TimeDelta::FromSeconds(kStreamCloseDelaySeconds); |
266 | 260 |
267 if (use_audio_output_resampler && | 261 if (use_audio_output_resampler && |
268 output_params.format() != AudioParameters::AUDIO_FAKE) { | 262 output_params.format() != AudioParameters::AUDIO_FAKE) { |
269 scoped_refptr<AudioOutputDispatcher> dispatcher = | 263 scoped_refptr<AudioOutputDispatcher> dispatcher = |
270 new AudioOutputResampler(this, params, output_params, close_delay); | 264 new AudioOutputResampler(this, params, output_params, close_delay); |
271 output_dispatchers_[dispatcher_key] = dispatcher; | 265 output_dispatchers_[dispatcher_key] = dispatcher; |
272 return new AudioOutputProxy(dispatcher); | 266 return new AudioOutputProxy(dispatcher); |
273 } | 267 } |
274 | 268 |
275 #if defined(ENABLE_AUDIO_MIXER) | |
276 // TODO(dalecurtis): Browser side mixing has a couple issues that must be | |
277 // fixed before it can be turned on by default: http://crbug.com/138098 and | |
278 // http://crbug.com/140247 | |
279 if (cmd_line->HasSwitch(switches::kEnableAudioMixer)) { | |
280 scoped_refptr<AudioOutputDispatcher> dispatcher = | |
281 new AudioOutputMixer(this, params, close_delay); | |
282 output_dispatchers_[dispatcher_key] = dispatcher; | |
283 return new AudioOutputProxy(dispatcher); | |
284 } | |
285 #endif | |
286 | |
287 scoped_refptr<AudioOutputDispatcher> dispatcher = | 269 scoped_refptr<AudioOutputDispatcher> dispatcher = |
288 new AudioOutputDispatcherImpl(this, output_params, close_delay); | 270 new AudioOutputDispatcherImpl(this, output_params, close_delay); |
289 output_dispatchers_[dispatcher_key] = dispatcher; | 271 output_dispatchers_[dispatcher_key] = dispatcher; |
290 return new AudioOutputProxy(dispatcher); | 272 return new AudioOutputProxy(dispatcher); |
291 #endif // defined(OS_IOS) | 273 #endif // defined(OS_IOS) |
292 } | 274 } |
293 | 275 |
294 bool AudioManagerBase::CanShowAudioInputSettings() { | 276 bool AudioManagerBase::CanShowAudioInputSettings() { |
295 return false; | 277 return false; |
296 } | 278 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 output_listeners_.RemoveObserver(listener); | 413 output_listeners_.RemoveObserver(listener); |
432 } | 414 } |
433 | 415 |
434 void AudioManagerBase::NotifyAllOutputDeviceChangeListeners() { | 416 void AudioManagerBase::NotifyAllOutputDeviceChangeListeners() { |
435 DCHECK(message_loop_->BelongsToCurrentThread()); | 417 DCHECK(message_loop_->BelongsToCurrentThread()); |
436 DVLOG(1) << "Firing OnDeviceChange() notifications."; | 418 DVLOG(1) << "Firing OnDeviceChange() notifications."; |
437 FOR_EACH_OBSERVER(AudioDeviceListener, output_listeners_, OnDeviceChange()); | 419 FOR_EACH_OBSERVER(AudioDeviceListener, output_listeners_, OnDeviceChange()); |
438 } | 420 } |
439 | 421 |
440 } // namespace media | 422 } // namespace media |
OLD | NEW |