| 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; | |
| 131 if (input_params.IsValid()) { | 130 if (input_params.IsValid()) { |
| 132 sample_rate = input_params.sample_rate(); | 131 sample_rate = input_params.sample_rate(); |
| 133 bits_per_sample = input_params.bits_per_sample(); | 132 bits_per_sample = input_params.bits_per_sample(); |
| 134 channel_layout = input_params.channel_layout(); | 133 channel_layout = input_params.channel_layout(); |
| 135 input_channels = input_params.input_channels(); | |
| 136 buffer_size = std::min(buffer_size, input_params.frames_per_buffer()); | 134 buffer_size = std::min(buffer_size, input_params.frames_per_buffer()); |
| 137 } | 135 } |
| 138 | 136 |
| 139 int user_buffer_size = GetUserBufferSize(); | 137 int user_buffer_size = GetUserBufferSize(); |
| 140 if (user_buffer_size) | 138 if (user_buffer_size) |
| 141 buffer_size = user_buffer_size; | 139 buffer_size = user_buffer_size; |
| 142 | 140 |
| 143 return AudioParameters( | 141 return AudioParameters( |
| 144 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, input_channels, | 142 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, |
| 145 sample_rate, bits_per_sample, buffer_size, AudioParameters::NO_EFFECTS); | 143 sample_rate, bits_per_sample, buffer_size, AudioParameters::NO_EFFECTS); |
| 146 } | 144 } |
| 147 | 145 |
| 148 AudioOutputStream* AudioManagerOpenBSD::MakeOutputStream( | 146 AudioOutputStream* AudioManagerOpenBSD::MakeOutputStream( |
| 149 const AudioParameters& params) { | 147 const AudioParameters& params) { |
| 150 if (pulse_library_is_initialized_) | 148 if (pulse_library_is_initialized_) |
| 151 return new PulseAudioOutputStream(params, this); | 149 return new PulseAudioOutputStream(params, this); |
| 152 | 150 |
| 153 return NULL; | 151 return NULL; |
| 154 } | 152 } |
| 155 | 153 |
| 156 // TODO(xians): Merge AudioManagerOpenBSD with AudioManagerPulse; | 154 // TODO(xians): Merge AudioManagerOpenBSD with AudioManagerPulse; |
| 157 // static | 155 // static |
| 158 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { | 156 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { |
| 159 return new AudioManagerOpenBSD(audio_log_factory); | 157 return new AudioManagerOpenBSD(audio_log_factory); |
| 160 } | 158 } |
| 161 | 159 |
| 162 } // namespace media | 160 } // namespace media |
| OLD | NEW |