| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/alsa/audio_manager_alsa.h" | 5 #include "media/audio/alsa/audio_manager_alsa.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/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 input_channels = input_params.input_channels(); | 326 input_channels = input_params.input_channels(); |
| 327 buffer_size = std::min(input_params.frames_per_buffer(), buffer_size); | 327 buffer_size = std::min(input_params.frames_per_buffer(), buffer_size); |
| 328 } | 328 } |
| 329 | 329 |
| 330 int user_buffer_size = GetUserBufferSize(); | 330 int user_buffer_size = GetUserBufferSize(); |
| 331 if (user_buffer_size) | 331 if (user_buffer_size) |
| 332 buffer_size = user_buffer_size; | 332 buffer_size = user_buffer_size; |
| 333 | 333 |
| 334 return AudioParameters( | 334 return AudioParameters( |
| 335 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, input_channels, | 335 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, input_channels, |
| 336 sample_rate, bits_per_sample, buffer_size, AudioParameters::NO_EFFECTS); | 336 sample_rate, bits_per_sample, buffer_size); |
| 337 } | 337 } |
| 338 | 338 |
| 339 AudioOutputStream* AudioManagerAlsa::MakeOutputStream( | 339 AudioOutputStream* AudioManagerAlsa::MakeOutputStream( |
| 340 const AudioParameters& params) { | 340 const AudioParameters& params) { |
| 341 std::string device_name = AlsaPcmOutputStream::kAutoSelectDevice; | 341 std::string device_name = AlsaPcmOutputStream::kAutoSelectDevice; |
| 342 if (CommandLine::ForCurrentProcess()->HasSwitch( | 342 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 343 switches::kAlsaOutputDevice)) { | 343 switches::kAlsaOutputDevice)) { |
| 344 device_name = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 344 device_name = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 345 switches::kAlsaOutputDevice); | 345 switches::kAlsaOutputDevice); |
| 346 } | 346 } |
| 347 return new AlsaPcmOutputStream(device_name, params, wrapper_.get(), this); | 347 return new AlsaPcmOutputStream(device_name, params, wrapper_.get(), this); |
| 348 } | 348 } |
| 349 | 349 |
| 350 AudioInputStream* AudioManagerAlsa::MakeInputStream( | 350 AudioInputStream* AudioManagerAlsa::MakeInputStream( |
| 351 const AudioParameters& params, const std::string& device_id) { | 351 const AudioParameters& params, const std::string& device_id) { |
| 352 std::string device_name = (device_id == AudioManagerBase::kDefaultDeviceId) ? | 352 std::string device_name = (device_id == AudioManagerBase::kDefaultDeviceId) ? |
| 353 AlsaPcmInputStream::kAutoSelectDevice : device_id; | 353 AlsaPcmInputStream::kAutoSelectDevice : device_id; |
| 354 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAlsaInputDevice)) { | 354 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAlsaInputDevice)) { |
| 355 device_name = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 355 device_name = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 356 switches::kAlsaInputDevice); | 356 switches::kAlsaInputDevice); |
| 357 } | 357 } |
| 358 | 358 |
| 359 return new AlsaPcmInputStream(this, device_name, params, wrapper_.get()); | 359 return new AlsaPcmInputStream(this, device_name, params, wrapper_.get()); |
| 360 } | 360 } |
| 361 | 361 |
| 362 } // namespace media | 362 } // namespace media |
| OLD | NEW |