| 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 sample_rate = input_params.sample_rate(); | 320 sample_rate = input_params.sample_rate(); |
| 321 bits_per_sample = input_params.bits_per_sample(); | 321 bits_per_sample = input_params.bits_per_sample(); |
| 322 channel_layout = input_params.channel_layout(); | 322 channel_layout = input_params.channel_layout(); |
| 323 buffer_size = std::min(input_params.frames_per_buffer(), buffer_size); | 323 buffer_size = std::min(input_params.frames_per_buffer(), buffer_size); |
| 324 } | 324 } |
| 325 | 325 |
| 326 int user_buffer_size = GetUserBufferSize(); | 326 int user_buffer_size = GetUserBufferSize(); |
| 327 if (user_buffer_size) | 327 if (user_buffer_size) |
| 328 buffer_size = user_buffer_size; | 328 buffer_size = user_buffer_size; |
| 329 | 329 |
| 330 return AudioParameters( | 330 return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, |
| 331 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, | 331 sample_rate, bits_per_sample, buffer_size); |
| 332 sample_rate, bits_per_sample, buffer_size, AudioParameters::NO_EFFECTS); | |
| 333 } | 332 } |
| 334 | 333 |
| 335 AudioOutputStream* AudioManagerAlsa::MakeOutputStream( | 334 AudioOutputStream* AudioManagerAlsa::MakeOutputStream( |
| 336 const AudioParameters& params) { | 335 const AudioParameters& params) { |
| 337 std::string device_name = AlsaPcmOutputStream::kAutoSelectDevice; | 336 std::string device_name = AlsaPcmOutputStream::kAutoSelectDevice; |
| 338 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 337 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 339 switches::kAlsaOutputDevice)) { | 338 switches::kAlsaOutputDevice)) { |
| 340 device_name = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 339 device_name = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 341 switches::kAlsaOutputDevice); | 340 switches::kAlsaOutputDevice); |
| 342 } | 341 } |
| 343 return new AlsaPcmOutputStream(device_name, params, wrapper_.get(), this); | 342 return new AlsaPcmOutputStream(device_name, params, wrapper_.get(), this); |
| 344 } | 343 } |
| 345 | 344 |
| 346 AudioInputStream* AudioManagerAlsa::MakeInputStream( | 345 AudioInputStream* AudioManagerAlsa::MakeInputStream( |
| 347 const AudioParameters& params, const std::string& device_id) { | 346 const AudioParameters& params, const std::string& device_id) { |
| 348 std::string device_name = (device_id == AudioManagerBase::kDefaultDeviceId) ? | 347 std::string device_name = (device_id == AudioManagerBase::kDefaultDeviceId) ? |
| 349 AlsaPcmInputStream::kAutoSelectDevice : device_id; | 348 AlsaPcmInputStream::kAutoSelectDevice : device_id; |
| 350 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 349 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 351 switches::kAlsaInputDevice)) { | 350 switches::kAlsaInputDevice)) { |
| 352 device_name = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 351 device_name = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 353 switches::kAlsaInputDevice); | 352 switches::kAlsaInputDevice); |
| 354 } | 353 } |
| 355 | 354 |
| 356 return new AlsaPcmInputStream(this, device_name, params, wrapper_.get()); | 355 return new AlsaPcmInputStream(this, device_name, params, wrapper_.get()); |
| 357 } | 356 } |
| 358 | 357 |
| 359 } // namespace media | 358 } // namespace media |
| OLD | NEW |