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

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

Issue 509893002: Revert of Remove the last piece of deprecated synchronous IO code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 169
170 AudioParameters AudioManagerPulse::GetPreferredOutputStreamParameters( 170 AudioParameters AudioManagerPulse::GetPreferredOutputStreamParameters(
171 const std::string& output_device_id, 171 const std::string& output_device_id,
172 const AudioParameters& input_params) { 172 const AudioParameters& input_params) {
173 // TODO(tommi): Support |output_device_id|. 173 // TODO(tommi): Support |output_device_id|.
174 VLOG_IF(0, !output_device_id.empty()) << "Not implemented!"; 174 VLOG_IF(0, !output_device_id.empty()) << "Not implemented!";
175 175
176 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; 176 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
177 int buffer_size = kMinimumOutputBufferSize; 177 int buffer_size = kMinimumOutputBufferSize;
178 int bits_per_sample = 16; 178 int bits_per_sample = 16;
179 int input_channels = 0;
179 int sample_rate = GetNativeSampleRate(); 180 int sample_rate = GetNativeSampleRate();
180 if (input_params.IsValid()) { 181 if (input_params.IsValid()) {
181 bits_per_sample = input_params.bits_per_sample(); 182 bits_per_sample = input_params.bits_per_sample();
182 channel_layout = input_params.channel_layout(); 183 channel_layout = input_params.channel_layout();
184 input_channels = input_params.input_channels();
183 buffer_size = 185 buffer_size =
184 std::min(kMaximumOutputBufferSize, 186 std::min(kMaximumOutputBufferSize,
185 std::max(buffer_size, input_params.frames_per_buffer())); 187 std::max(buffer_size, input_params.frames_per_buffer()));
186 } 188 }
187 189
188 int user_buffer_size = GetUserBufferSize(); 190 int user_buffer_size = GetUserBufferSize();
189 if (user_buffer_size) 191 if (user_buffer_size)
190 buffer_size = user_buffer_size; 192 buffer_size = user_buffer_size;
191 193
192 return AudioParameters( 194 return AudioParameters(
193 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, 195 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, input_channels,
194 sample_rate, bits_per_sample, buffer_size, AudioParameters::NO_EFFECTS); 196 sample_rate, bits_per_sample, buffer_size, AudioParameters::NO_EFFECTS);
195 } 197 }
196 198
197 AudioOutputStream* AudioManagerPulse::MakeOutputStream( 199 AudioOutputStream* AudioManagerPulse::MakeOutputStream(
198 const AudioParameters& params, 200 const AudioParameters& params,
199 const std::string& device_id) { 201 const std::string& device_id) {
200 DCHECK(!device_id.empty()); 202 DCHECK(!device_id.empty());
201 return new PulseAudioOutputStream(params, device_id, this); 203 return new PulseAudioOutputStream(params, device_id, this);
202 } 204 }
203 205
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 void AudioManagerPulse::SampleRateInfoCallback(pa_context* context, 335 void AudioManagerPulse::SampleRateInfoCallback(pa_context* context,
334 const pa_server_info* info, 336 const pa_server_info* info,
335 void* user_data) { 337 void* user_data) {
336 AudioManagerPulse* manager = reinterpret_cast<AudioManagerPulse*>(user_data); 338 AudioManagerPulse* manager = reinterpret_cast<AudioManagerPulse*>(user_data);
337 339
338 manager->native_input_sample_rate_ = info->sample_spec.rate; 340 manager->native_input_sample_rate_ = info->sample_spec.rate;
339 pa_threaded_mainloop_signal(manager->input_mainloop_, 0); 341 pa_threaded_mainloop_signal(manager->input_mainloop_, 0);
340 } 342 }
341 343
342 } // namespace media 344 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/openbsd/audio_manager_openbsd.cc ('k') | media/audio/win/audio_low_latency_input_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698