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

Side by Side Diff: media/audio/cras/audio_manager_cras.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/cras/audio_manager_cras.h" 5 #include "media/audio/cras/audio_manager_cras.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/logging.h" 9 #include "base/logging.h"
10 #include "base/nix/xdg_util.h" 10 #include "base/nix/xdg_util.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; 108 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
109 int sample_rate = kDefaultSampleRate; 109 int sample_rate = kDefaultSampleRate;
110 int buffer_size = kDefaultOutputBufferSize; 110 int buffer_size = kDefaultOutputBufferSize;
111 int bits_per_sample = 16; 111 int bits_per_sample = 16;
112 int input_channels = 0; 112 int input_channels = 0;
113 if (input_params.IsValid()) { 113 if (input_params.IsValid()) {
114 sample_rate = input_params.sample_rate(); 114 sample_rate = input_params.sample_rate();
115 bits_per_sample = input_params.bits_per_sample(); 115 bits_per_sample = input_params.bits_per_sample();
116 channel_layout = input_params.channel_layout(); 116 channel_layout = input_params.channel_layout();
117 input_channels = input_params.input_channels(); 117 input_channels = input_params.input_channels();
118 buffer_size = input_params.frames_per_buffer(); 118 buffer_size = std::max(buffer_size, input_params.frames_per_buffer());
119 } 119 }
120 120
121 int user_buffer_size = GetUserBufferSize(); 121 int user_buffer_size = GetUserBufferSize();
122 if (user_buffer_size) 122 if (user_buffer_size)
123 buffer_size = user_buffer_size; 123 buffer_size = user_buffer_size;
124 124
125 return AudioParameters( 125 return AudioParameters(
126 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, input_channels, 126 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, input_channels,
127 sample_rate, bits_per_sample, buffer_size, AudioParameters::NO_EFFECTS); 127 sample_rate, bits_per_sample, buffer_size, AudioParameters::NO_EFFECTS);
128 } 128 }
(...skipping 17 matching lines...) Expand all
146 case 24: 146 case 24:
147 return SND_PCM_FORMAT_S24; 147 return SND_PCM_FORMAT_S24;
148 case 32: 148 case 32:
149 return SND_PCM_FORMAT_S32; 149 return SND_PCM_FORMAT_S32;
150 default: 150 default:
151 return SND_PCM_FORMAT_UNKNOWN; 151 return SND_PCM_FORMAT_UNKNOWN;
152 } 152 }
153 } 153 }
154 154
155 } // namespace media 155 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698