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

Side by Side Diff: media/audio/pulse/audio_manager_pulse.cc

Issue 16348003: Merge 202233 "Allow sample rate pass through on Linux." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1500/src/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/media/audio_renderer_mixer_manager.cc ('k') | media/audio/pulse/pulse_util.cc » ('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/pulse/audio_manager_pulse.h" 5 #include "media/audio/pulse/audio_manager_pulse.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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 135
136 AudioParameters AudioManagerPulse::GetPreferredOutputStreamParameters( 136 AudioParameters AudioManagerPulse::GetPreferredOutputStreamParameters(
137 const AudioParameters& input_params) { 137 const AudioParameters& input_params) {
138 static const int kDefaultOutputBufferSize = 512; 138 static const int kDefaultOutputBufferSize = 512;
139 139
140 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; 140 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
141 int buffer_size = kDefaultOutputBufferSize; 141 int buffer_size = kDefaultOutputBufferSize;
142 int bits_per_sample = 16; 142 int bits_per_sample = 16;
143 int input_channels = 0; 143 int input_channels = 0;
144 int sample_rate;
144 if (input_params.IsValid()) { 145 if (input_params.IsValid()) {
145 bits_per_sample = input_params.bits_per_sample(); 146 bits_per_sample = input_params.bits_per_sample();
146 channel_layout = input_params.channel_layout(); 147 channel_layout = input_params.channel_layout();
147 input_channels = input_params.input_channels(); 148 input_channels = input_params.input_channels();
148 buffer_size = std::min(buffer_size, input_params.frames_per_buffer()); 149 buffer_size = std::min(buffer_size, input_params.frames_per_buffer());
150 sample_rate = input_params.sample_rate();
151 } else {
152 sample_rate = GetNativeSampleRate();
149 } 153 }
150 154
151 int user_buffer_size = GetUserBufferSize(); 155 int user_buffer_size = GetUserBufferSize();
152 if (user_buffer_size) 156 if (user_buffer_size)
153 buffer_size = user_buffer_size; 157 buffer_size = user_buffer_size;
154 158
155 return AudioParameters( 159 return AudioParameters(
156 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, input_channels, 160 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, input_channels,
157 GetNativeSampleRate(), bits_per_sample, buffer_size); 161 sample_rate, bits_per_sample, buffer_size);
158 } 162 }
159 163
160 AudioOutputStream* AudioManagerPulse::MakeOutputStream( 164 AudioOutputStream* AudioManagerPulse::MakeOutputStream(
161 const AudioParameters& params) { 165 const AudioParameters& params) {
162 if (params.input_channels()) { 166 if (params.input_channels()) {
163 return new PulseAudioUnifiedStream(params, this); 167 return new PulseAudioUnifiedStream(params, this);
164 } 168 }
165 169
166 return new PulseAudioOutputStream(params, this); 170 return new PulseAudioOutputStream(params, this);
167 } 171 }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 void AudioManagerPulse::SampleRateInfoCallback(pa_context* context, 290 void AudioManagerPulse::SampleRateInfoCallback(pa_context* context,
287 const pa_server_info* info, 291 const pa_server_info* info,
288 void* user_data) { 292 void* user_data) {
289 AudioManagerPulse* manager = reinterpret_cast<AudioManagerPulse*>(user_data); 293 AudioManagerPulse* manager = reinterpret_cast<AudioManagerPulse*>(user_data);
290 294
291 manager->native_input_sample_rate_ = info->sample_spec.rate; 295 manager->native_input_sample_rate_ = info->sample_spec.rate;
292 pa_threaded_mainloop_signal(manager->input_mainloop_, 0); 296 pa_threaded_mainloop_signal(manager->input_mainloop_, 0);
293 } 297 }
294 298
295 } // namespace media 299 } // namespace media
OLDNEW
« no previous file with comments | « content/renderer/media/audio_renderer_mixer_manager.cc ('k') | media/audio/pulse/pulse_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698