| 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" | |
| 9 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
| 10 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 11 #include "media/audio/audio_output_dispatcher_impl.h" | 10 #include "media/audio/audio_output_dispatcher_impl.h" |
| 12 #include "media/audio/audio_output_mixer.h" | 11 #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 |
| 18 namespace media { | 17 namespace media { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 134 |
| 136 AudioOutputStream* AudioManagerBase::MakeAudioOutputStreamProxy( | 135 AudioOutputStream* AudioManagerBase::MakeAudioOutputStreamProxy( |
| 137 const AudioParameters& params) { | 136 const AudioParameters& params) { |
| 138 DCHECK(GetMessageLoop()->BelongsToCurrentThread()); | 137 DCHECK(GetMessageLoop()->BelongsToCurrentThread()); |
| 139 | 138 |
| 140 scoped_refptr<AudioOutputDispatcher>& dispatcher = | 139 scoped_refptr<AudioOutputDispatcher>& dispatcher = |
| 141 output_dispatchers_[params]; | 140 output_dispatchers_[params]; |
| 142 if (!dispatcher) { | 141 if (!dispatcher) { |
| 143 base::TimeDelta close_delay = | 142 base::TimeDelta close_delay = |
| 144 base::TimeDelta::FromSeconds(kStreamCloseDelaySeconds); | 143 base::TimeDelta::FromSeconds(kStreamCloseDelaySeconds); |
| 145 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 144 dispatcher = new AudioOutputMixer(this, params, close_delay); |
| 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 } | 145 } |
| 152 return new AudioOutputProxy(dispatcher); | 146 return new AudioOutputProxy(dispatcher); |
| 153 } | 147 } |
| 154 | 148 |
| 155 bool AudioManagerBase::CanShowAudioInputSettings() { | 149 bool AudioManagerBase::CanShowAudioInputSettings() { |
| 156 return false; | 150 return false; |
| 157 } | 151 } |
| 158 | 152 |
| 159 void AudioManagerBase::ShowAudioInputSettings() { | 153 void AudioManagerBase::ShowAudioInputSettings() { |
| 160 } | 154 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // So, better crash now than later. | 227 // So, better crash now than later. |
| 234 DCHECK(dispatcher->HasOneRef()) << "AudioOutputProxies are still alive"; | 228 DCHECK(dispatcher->HasOneRef()) << "AudioOutputProxies are still alive"; |
| 235 dispatcher = NULL; | 229 dispatcher = NULL; |
| 236 } | 230 } |
| 237 } | 231 } |
| 238 | 232 |
| 239 output_dispatchers_.clear(); | 233 output_dispatchers_.clear(); |
| 240 } | 234 } |
| 241 | 235 |
| 242 } // namespace media | 236 } // namespace media |
| OLD | NEW |