| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 } | 127 } |
| 128 | 128 |
| 129 AudioParameters AudioManagerPulse::GetInputStreamParameters( | 129 AudioParameters AudioManagerPulse::GetInputStreamParameters( |
| 130 const std::string& device_id) { | 130 const std::string& device_id) { |
| 131 int user_buffer_size = GetUserBufferSize(); | 131 int user_buffer_size = GetUserBufferSize(); |
| 132 int buffer_size = user_buffer_size ? | 132 int buffer_size = user_buffer_size ? |
| 133 user_buffer_size : kDefaultInputBufferSize; | 133 user_buffer_size : kDefaultInputBufferSize; |
| 134 | 134 |
| 135 // TODO(xians): add support for querying native channel layout for pulse. | 135 // TODO(xians): add support for querying native channel layout for pulse. |
| 136 return AudioParameters( | 136 return AudioParameters( |
| 137 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, | 137 AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 138 CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC, |
| 139 // CHANNEL_LAYOUT_STEREO, |
| 138 GetNativeSampleRate(), 16, buffer_size); | 140 GetNativeSampleRate(), 16, buffer_size); |
| 139 } | 141 } |
| 140 | 142 |
| 141 AudioOutputStream* AudioManagerPulse::MakeLinearOutputStream( | 143 AudioOutputStream* AudioManagerPulse::MakeLinearOutputStream( |
| 142 const AudioParameters& params) { | 144 const AudioParameters& params) { |
| 143 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); | 145 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); |
| 144 return MakeOutputStream(params, AudioManagerBase::kDefaultDeviceId); | 146 return MakeOutputStream(params, AudioManagerBase::kDefaultDeviceId); |
| 145 } | 147 } |
| 146 | 148 |
| 147 AudioOutputStream* AudioManagerPulse::MakeLowLatencyOutputStream( | 149 AudioOutputStream* AudioManagerPulse::MakeLowLatencyOutputStream( |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 void AudioManagerPulse::SampleRateInfoCallback(pa_context* context, | 335 void AudioManagerPulse::SampleRateInfoCallback(pa_context* context, |
| 334 const pa_server_info* info, | 336 const pa_server_info* info, |
| 335 void* user_data) { | 337 void* user_data) { |
| 336 AudioManagerPulse* manager = reinterpret_cast<AudioManagerPulse*>(user_data); | 338 AudioManagerPulse* manager = reinterpret_cast<AudioManagerPulse*>(user_data); |
| 337 | 339 |
| 338 manager->native_input_sample_rate_ = info->sample_spec.rate; | 340 manager->native_input_sample_rate_ = info->sample_spec.rate; |
| 339 pa_threaded_mainloop_signal(manager->input_mainloop_, 0); | 341 pa_threaded_mainloop_signal(manager->input_mainloop_, 0); |
| 340 } | 342 } |
| 341 | 343 |
| 342 } // namespace media | 344 } // namespace media |
| OLD | NEW |