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

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

Issue 285233005: add audio-buffer-size command line flag support to the input audio for all the platforms (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « media/audio/alsa/audio_manager_alsa.h ('k') | media/audio/android/audio_manager_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 DCHECK(device_names->empty()); 100 DCHECK(device_names->empty());
101 GetAlsaAudioDevices(kStreamCapture, device_names); 101 GetAlsaAudioDevices(kStreamCapture, device_names);
102 } 102 }
103 103
104 void AudioManagerAlsa::GetAudioOutputDeviceNames( 104 void AudioManagerAlsa::GetAudioOutputDeviceNames(
105 AudioDeviceNames* device_names) { 105 AudioDeviceNames* device_names) {
106 DCHECK(device_names->empty()); 106 DCHECK(device_names->empty());
107 GetAlsaAudioDevices(kStreamPlayback, device_names); 107 GetAlsaAudioDevices(kStreamPlayback, device_names);
108 } 108 }
109 109
110 AudioParameters AudioManagerAlsa::GetInputStreamParameters( 110 AudioParameters AudioManagerAlsa::GetPreferredInputStreamParameters(
111 const std::string& device_id) { 111 const std::string& input_device_id,
112 const AudioParameters& input_params) {
112 static const int kDefaultInputBufferSize = 1024; 113 static const int kDefaultInputBufferSize = 1024;
114 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
115 int sample_rate = kDefaultSampleRate;
116 int buffer_size = kDefaultInputBufferSize;
117 int bits_per_sample = 16;
118 if (input_params.IsValid()) {
119 sample_rate = input_params.sample_rate();
120 bits_per_sample = input_params.bits_per_sample();
121 channel_layout = input_params.channel_layout();
122 buffer_size = input_params.frames_per_buffer();
123 }
113 124
114 return AudioParameters( 125 return AudioParameters(
115 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, 126 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
116 kDefaultSampleRate, 16, kDefaultInputBufferSize); 127 sample_rate, bits_per_sample, buffer_size);
117 } 128 }
118 129
119 void AudioManagerAlsa::GetAlsaAudioDevices( 130 void AudioManagerAlsa::GetAlsaAudioDevices(
120 StreamType type, 131 StreamType type,
121 media::AudioDeviceNames* device_names) { 132 media::AudioDeviceNames* device_names) {
122 // Constants specified by the ALSA API for device hints. 133 // Constants specified by the ALSA API for device hints.
123 static const char kPcmInterfaceName[] = "pcm"; 134 static const char kPcmInterfaceName[] = "pcm";
124 int card = -1; 135 int card = -1;
125 136
126 // Loop through the sound cards to get ALSA device hints. 137 // Loop through the sound cards to get ALSA device hints.
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 AlsaPcmInputStream::kAutoSelectDevice : device_id; 362 AlsaPcmInputStream::kAutoSelectDevice : device_id;
352 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAlsaInputDevice)) { 363 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAlsaInputDevice)) {
353 device_name = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 364 device_name = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
354 switches::kAlsaInputDevice); 365 switches::kAlsaInputDevice);
355 } 366 }
356 367
357 return new AlsaPcmInputStream(this, device_name, params, wrapper_.get()); 368 return new AlsaPcmInputStream(this, device_name, params, wrapper_.get());
358 } 369 }
359 370
360 } // namespace media 371 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/alsa/audio_manager_alsa.h ('k') | media/audio/android/audio_manager_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698