| 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" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 DCHECK(GetMessageLoop()->BelongsToCurrentThread()); | 150 DCHECK(GetMessageLoop()->BelongsToCurrentThread()); |
| 151 | 151 |
| 152 AudioOutputDispatchersMap::iterator it = output_dispatchers_.find(params); | 152 AudioOutputDispatchersMap::iterator it = output_dispatchers_.find(params); |
| 153 if (it != output_dispatchers_.end()) | 153 if (it != output_dispatchers_.end()) |
| 154 return new AudioOutputProxy(it->second); | 154 return new AudioOutputProxy(it->second); |
| 155 | 155 |
| 156 base::TimeDelta close_delay = | 156 base::TimeDelta close_delay = |
| 157 base::TimeDelta::FromSeconds(kStreamCloseDelaySeconds); | 157 base::TimeDelta::FromSeconds(kStreamCloseDelaySeconds); |
| 158 | 158 |
| 159 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 159 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 160 if (cmd_line->HasSwitch(switches::kEnableAudioOutputResampler) && | 160 if (!cmd_line->HasSwitch(switches::kDisableAudioOutputResampler) && |
| 161 params.format() == AudioParameters::AUDIO_PCM_LOW_LATENCY) { | 161 params.format() == AudioParameters::AUDIO_PCM_LOW_LATENCY) { |
| 162 scoped_refptr<AudioOutputDispatcher> dispatcher = new AudioOutputResampler( | 162 scoped_refptr<AudioOutputDispatcher> dispatcher = new AudioOutputResampler( |
| 163 this, params, GetPreferredLowLatencyOutputStreamParameters(params), | 163 this, params, GetPreferredLowLatencyOutputStreamParameters(params), |
| 164 close_delay); | 164 close_delay); |
| 165 output_dispatchers_[params] = dispatcher; | 165 output_dispatchers_[params] = dispatcher; |
| 166 return new AudioOutputProxy(dispatcher); | 166 return new AudioOutputProxy(dispatcher); |
| 167 } | 167 } |
| 168 | 168 |
| 169 #if defined(ENABLE_AUDIO_MIXER) | 169 #if defined(ENABLE_AUDIO_MIXER) |
| 170 // TODO(dalecurtis): Browser side mixing has a couple issues that must be | 170 // TODO(dalecurtis): Browser side mixing has a couple issues that must be |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 #else | 286 #else |
| 287 // TODO(dalecurtis): This should include bits per channel and channel layout | 287 // TODO(dalecurtis): This should include bits per channel and channel layout |
| 288 // eventually. | 288 // eventually. |
| 289 return AudioParameters( | 289 return AudioParameters( |
| 290 AudioParameters::AUDIO_PCM_LOW_LATENCY, input_params.channel_layout(), | 290 AudioParameters::AUDIO_PCM_LOW_LATENCY, input_params.channel_layout(), |
| 291 GetAudioHardwareSampleRate(), 16, GetAudioHardwareBufferSize()); | 291 GetAudioHardwareSampleRate(), 16, GetAudioHardwareBufferSize()); |
| 292 #endif // defined(OS_IOS) | 292 #endif // defined(OS_IOS) |
| 293 } | 293 } |
| 294 | 294 |
| 295 } // namespace media | 295 } // namespace media |
| OLD | NEW |