| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |