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

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

Issue 235723003: Use larger buffer sizes for lower power on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 165
166 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; 166 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
167 int buffer_size = kDefaultOutputBufferSize; 167 int buffer_size = kDefaultOutputBufferSize;
168 int bits_per_sample = 16; 168 int bits_per_sample = 16;
169 int input_channels = 0; 169 int input_channels = 0;
170 int sample_rate; 170 int sample_rate;
171 if (input_params.IsValid()) { 171 if (input_params.IsValid()) {
172 bits_per_sample = input_params.bits_per_sample(); 172 bits_per_sample = input_params.bits_per_sample();
173 channel_layout = input_params.channel_layout(); 173 channel_layout = input_params.channel_layout();
174 input_channels = input_params.input_channels(); 174 input_channels = input_params.input_channels();
175 buffer_size = std::min(buffer_size, input_params.frames_per_buffer()); 175 buffer_size = std::max(buffer_size, input_params.frames_per_buffer());
176 sample_rate = input_params.sample_rate(); 176 sample_rate = input_params.sample_rate();
177 } else { 177 } else {
178 sample_rate = GetNativeSampleRate(); 178 sample_rate = GetNativeSampleRate();
179 } 179 }
180 180
181 int user_buffer_size = GetUserBufferSize(); 181 int user_buffer_size = GetUserBufferSize();
182 if (user_buffer_size) 182 if (user_buffer_size)
183 buffer_size = user_buffer_size; 183 buffer_size = user_buffer_size;
184 184
185 return AudioParameters( 185 return AudioParameters(
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 void AudioManagerPulse::SampleRateInfoCallback(pa_context* context, 326 void AudioManagerPulse::SampleRateInfoCallback(pa_context* context,
327 const pa_server_info* info, 327 const pa_server_info* info,
328 void* user_data) { 328 void* user_data) {
329 AudioManagerPulse* manager = reinterpret_cast<AudioManagerPulse*>(user_data); 329 AudioManagerPulse* manager = reinterpret_cast<AudioManagerPulse*>(user_data);
330 330
331 manager->native_input_sample_rate_ = info->sample_spec.rate; 331 manager->native_input_sample_rate_ = info->sample_spec.rate;
332 pa_threaded_mainloop_signal(manager->input_mainloop_, 0); 332 pa_threaded_mainloop_signal(manager->input_mainloop_, 0);
333 } 333 }
334 334
335 } // namespace media 335 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698