OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/openbsd/audio_manager_openbsd.h" | 5 #include "media/audio/openbsd/audio_manager_openbsd.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 const std::string& output_device_id, | 120 const std::string& output_device_id, |
121 const AudioParameters& input_params) { | 121 const AudioParameters& input_params) { |
122 // TODO(tommi): Support |output_device_id|. | 122 // TODO(tommi): Support |output_device_id|. |
123 DLOG_IF(ERROR, !output_device_id.empty()) << "Not implemented!"; | 123 DLOG_IF(ERROR, !output_device_id.empty()) << "Not implemented!"; |
124 static const int kDefaultOutputBufferSize = 512; | 124 static const int kDefaultOutputBufferSize = 512; |
125 | 125 |
126 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; | 126 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; |
127 int sample_rate = kDefaultSampleRate; | 127 int sample_rate = kDefaultSampleRate; |
128 int buffer_size = kDefaultOutputBufferSize; | 128 int buffer_size = kDefaultOutputBufferSize; |
129 int bits_per_sample = 16; | 129 int bits_per_sample = 16; |
| 130 int input_channels = 0; |
130 if (input_params.IsValid()) { | 131 if (input_params.IsValid()) { |
131 sample_rate = input_params.sample_rate(); | 132 sample_rate = input_params.sample_rate(); |
132 bits_per_sample = input_params.bits_per_sample(); | 133 bits_per_sample = input_params.bits_per_sample(); |
133 channel_layout = input_params.channel_layout(); | 134 channel_layout = input_params.channel_layout(); |
| 135 input_channels = input_params.input_channels(); |
134 buffer_size = std::min(buffer_size, input_params.frames_per_buffer()); | 136 buffer_size = std::min(buffer_size, input_params.frames_per_buffer()); |
135 } | 137 } |
136 | 138 |
137 int user_buffer_size = GetUserBufferSize(); | 139 int user_buffer_size = GetUserBufferSize(); |
138 if (user_buffer_size) | 140 if (user_buffer_size) |
139 buffer_size = user_buffer_size; | 141 buffer_size = user_buffer_size; |
140 | 142 |
141 return AudioParameters( | 143 return AudioParameters( |
142 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, | 144 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, input_channels, |
143 sample_rate, bits_per_sample, buffer_size, AudioParameters::NO_EFFECTS); | 145 sample_rate, bits_per_sample, buffer_size, AudioParameters::NO_EFFECTS); |
144 } | 146 } |
145 | 147 |
146 AudioOutputStream* AudioManagerOpenBSD::MakeOutputStream( | 148 AudioOutputStream* AudioManagerOpenBSD::MakeOutputStream( |
147 const AudioParameters& params) { | 149 const AudioParameters& params) { |
148 if (pulse_library_is_initialized_) | 150 if (pulse_library_is_initialized_) |
149 return new PulseAudioOutputStream(params, this); | 151 return new PulseAudioOutputStream(params, this); |
150 | 152 |
151 return NULL; | 153 return NULL; |
152 } | 154 } |
153 | 155 |
154 // TODO(xians): Merge AudioManagerOpenBSD with AudioManagerPulse; | 156 // TODO(xians): Merge AudioManagerOpenBSD with AudioManagerPulse; |
155 // static | 157 // static |
156 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { | 158 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { |
157 return new AudioManagerOpenBSD(audio_log_factory); | 159 return new AudioManagerOpenBSD(audio_log_factory); |
158 } | 160 } |
159 | 161 |
160 } // namespace media | 162 } // namespace media |
OLD | NEW |