Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: media/audio/alsa/audio_manager_alsa.cc

Issue 1275783003: Add a virtual beamforming audio device on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only add virtual device if we have at least two mics. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698