Chromium Code Reviews| 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/linux/audio_manager_linux.h" | 5 #include "media/audio/linux/audio_manager_linux.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/environment.h" | 8 #include "base/environment.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/nix/xdg_util.h" | 10 #include "base/nix/xdg_util.h" |
| 11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "media/audio/audio_output_dispatcher.h" | 13 #include "media/audio/audio_output_dispatcher.h" |
| 14 #include "media/audio/linux/alsa_input.h" | 14 #include "media/audio/linux/alsa_input.h" |
| 15 #include "media/audio/linux/alsa_output.h" | 15 #include "media/audio/linux/alsa_output.h" |
| 16 #include "media/audio/linux/alsa_wrapper.h" | 16 #include "media/audio/linux/alsa_wrapper.h" |
| 17 #if defined(USE_PULSEAUDIO) | 17 #if defined(USE_PULSEAUDIO) |
| 18 #include "media/audio/pulse/pulse_output.h" | 18 #include "media/audio/pulse/pulse_output.h" |
| 19 #endif | 19 #endif |
| 20 #if defined(USE_CRAS) | 20 #if defined(USE_CRAS) |
| 21 #include "media/audio/linux/cras_input.h" | |
| 21 #include "media/audio/linux/cras_output.h" | 22 #include "media/audio/linux/cras_output.h" |
| 22 #endif | 23 #endif |
| 23 #include "media/base/limits.h" | 24 #include "media/base/limits.h" |
| 24 #include "media/base/media_switches.h" | 25 #include "media/base/media_switches.h" |
| 25 | 26 |
| 26 namespace media { | 27 namespace media { |
| 27 | 28 |
| 28 // Maximum number of output streams that can be open simultaneously. | 29 // Maximum number of output streams that can be open simultaneously. |
| 29 static const int kMaxOutputStreams = 50; | 30 static const int kMaxOutputStreams = 50; |
| 30 | 31 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 290 #endif | 291 #endif |
| 291 #if defined(USE_CRAS) | 292 #if defined(USE_CRAS) |
| 292 } | 293 } |
| 293 #endif | 294 #endif |
| 294 DCHECK(stream); | 295 DCHECK(stream); |
| 295 return stream; | 296 return stream; |
| 296 } | 297 } |
| 297 | 298 |
| 298 AudioInputStream* AudioManagerLinux::MakeInputStream( | 299 AudioInputStream* AudioManagerLinux::MakeInputStream( |
| 299 const AudioParameters& params, const std::string& device_id) { | 300 const AudioParameters& params, const std::string& device_id) { |
| 301 AudioInputStream* stream = NULL; | |
| 300 | 302 |
| 303 #if defined(USE_CRAS) | |
| 304 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseCras)) { | |
| 305 stream = new CrasInputStream(params, this); | |
|
no longer working on chromium
2012/06/20 10:45:26
btw, do you support device selection? or any plan
dgreid
2012/06/20 17:14:25
The hope is that ChromeOS automatically selecting
| |
| 306 } else { | |
|
no longer working on chromium
2012/06/20 10:45:26
Why do we need the else case, it is a bit hard to
dgreid
2012/06/20 17:14:25
Good suggestion, I also took the opportunity to mo
| |
| 307 #endif | |
| 301 std::string device_name = (device_id == AudioManagerBase::kDefaultDeviceId) ? | 308 std::string device_name = (device_id == AudioManagerBase::kDefaultDeviceId) ? |
| 302 AlsaPcmInputStream::kAutoSelectDevice : device_id; | 309 AlsaPcmInputStream::kAutoSelectDevice : device_id; |
| 303 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAlsaInputDevice)) { | 310 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAlsaInputDevice)) { |
| 304 device_name = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 311 device_name = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 305 switches::kAlsaInputDevice); | 312 switches::kAlsaInputDevice); |
| 306 } | 313 } |
| 307 | 314 |
| 308 return new AlsaPcmInputStream(this, device_name, params, wrapper_.get()); | 315 stream = new AlsaPcmInputStream(this, device_name, params, wrapper_.get()); |
| 316 #if defined(USE_CRAS) | |
| 317 } | |
| 318 #endif | |
| 319 | |
| 320 DCHECK(stream); | |
| 321 return stream; | |
| 309 } | 322 } |
| 310 | 323 |
| 311 AudioManager* CreateAudioManager() { | 324 AudioManager* CreateAudioManager() { |
| 312 return new AudioManagerLinux(); | 325 return new AudioManagerLinux(); |
| 313 } | 326 } |
| 314 | 327 |
| 315 } // namespace media | 328 } // namespace media |
| OLD | NEW |