| 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/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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 int buffer_size = user_buffer_size ? | 136 int buffer_size = user_buffer_size ? |
| 137 user_buffer_size : kDefaultInputBufferSize; | 137 user_buffer_size : kDefaultInputBufferSize; |
| 138 | 138 |
| 139 // TODO(xians): add support for querying native channel layout for pulse. | 139 // TODO(xians): add support for querying native channel layout for pulse. |
| 140 UpdateNativeAudioHardwareInfo(); | 140 UpdateNativeAudioHardwareInfo(); |
| 141 return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, | 141 return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 142 CHANNEL_LAYOUT_STEREO, native_input_sample_rate_, 16, | 142 CHANNEL_LAYOUT_STEREO, native_input_sample_rate_, 16, |
| 143 buffer_size); | 143 buffer_size); |
| 144 } | 144 } |
| 145 | 145 |
| 146 const char* AudioManagerPulse::GetName() { |
| 147 return "PulseAudio"; |
| 148 } |
| 149 |
| 146 AudioOutputStream* AudioManagerPulse::MakeLinearOutputStream( | 150 AudioOutputStream* AudioManagerPulse::MakeLinearOutputStream( |
| 147 const AudioParameters& params, | 151 const AudioParameters& params, |
| 148 const LogCallback& log_callback) { | 152 const LogCallback& log_callback) { |
| 149 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); | 153 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); |
| 150 return MakeOutputStream(params, AudioDeviceDescription::kDefaultDeviceId); | 154 return MakeOutputStream(params, AudioDeviceDescription::kDefaultDeviceId); |
| 151 } | 155 } |
| 152 | 156 |
| 153 AudioOutputStream* AudioManagerPulse::MakeLowLatencyOutputStream( | 157 AudioOutputStream* AudioManagerPulse::MakeLowLatencyOutputStream( |
| 154 const AudioParameters& params, | 158 const AudioParameters& params, |
| 155 const std::string& device_id, | 159 const std::string& device_id, |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 const pa_server_info* info, | 349 const pa_server_info* info, |
| 346 void* user_data) { | 350 void* user_data) { |
| 347 AudioManagerPulse* manager = reinterpret_cast<AudioManagerPulse*>(user_data); | 351 AudioManagerPulse* manager = reinterpret_cast<AudioManagerPulse*>(user_data); |
| 348 | 352 |
| 349 manager->native_input_sample_rate_ = info->sample_spec.rate; | 353 manager->native_input_sample_rate_ = info->sample_spec.rate; |
| 350 manager->native_channel_count_ = info->sample_spec.channels; | 354 manager->native_channel_count_ = info->sample_spec.channels; |
| 351 pa_threaded_mainloop_signal(manager->input_mainloop_, 0); | 355 pa_threaded_mainloop_signal(manager->input_mainloop_, 0); |
| 352 } | 356 } |
| 353 | 357 |
| 354 } // namespace media | 358 } // namespace media |
| OLD | NEW |