Chromium Code Reviews| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 } | 167 } |
| 168 | 168 |
| 169 AudioInputStream* AudioManagerPulse::MakeLowLatencyInputStream( | 169 AudioInputStream* AudioManagerPulse::MakeLowLatencyInputStream( |
| 170 const AudioParameters& params, | 170 const AudioParameters& params, |
| 171 const std::string& device_id, | 171 const std::string& device_id, |
| 172 const LogCallback& log_callback) { | 172 const LogCallback& log_callback) { |
| 173 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); | 173 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); |
| 174 return MakeInputStream(params, device_id); | 174 return MakeInputStream(params, device_id); |
| 175 } | 175 } |
| 176 | 176 |
| 177 std::string AudioManagerPulse::GetAssociatedOutputDeviceID( | |
| 178 const std::string& input_device_id) { | |
| 179 DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); | |
| 180 DCHECK(input_mainloop_); | |
| 181 DCHECK(input_context_); | |
| 182 if (input_device_id == AudioDeviceDescription::kDefaultDeviceId) { | |
|
Guido Urdaneta
2016/08/19 14:26:18
This check is wrong. The default output device is
| |
| 183 return AudioDeviceDescription::kDefaultDeviceId; | |
| 184 } | |
| 185 | |
| 186 std::string input_bus = | |
| 187 pulse::GetBusOfInput(input_device_id, input_mainloop_, input_context_); | |
| 188 if (input_bus.empty()) { | |
| 189 return ""; | |
| 190 } | |
| 191 std::string s = pulse::GetOutputCorrespondingTo(input_bus, input_mainloop_, | |
| 192 input_context_); | |
| 193 return s; | |
| 194 } | |
| 195 | |
| 177 AudioParameters AudioManagerPulse::GetPreferredOutputStreamParameters( | 196 AudioParameters AudioManagerPulse::GetPreferredOutputStreamParameters( |
| 178 const std::string& output_device_id, | 197 const std::string& output_device_id, |
| 179 const AudioParameters& input_params) { | 198 const AudioParameters& input_params) { |
| 180 // TODO(tommi): Support |output_device_id|. | 199 // TODO(tommi): Support |output_device_id|. |
| 181 VLOG_IF(0, !output_device_id.empty()) << "Not implemented!"; | 200 VLOG_IF(0, !output_device_id.empty()) << "Not implemented!"; |
| 182 | 201 |
| 183 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; | 202 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; |
| 184 int buffer_size = kMinimumOutputBufferSize; | 203 int buffer_size = kMinimumOutputBufferSize; |
| 185 int bits_per_sample = 16; | 204 int bits_per_sample = 16; |
| 186 int sample_rate = GetNativeSampleRate(); | 205 int sample_rate = GetNativeSampleRate(); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 void AudioManagerPulse::SampleRateInfoCallback(pa_context* context, | 358 void AudioManagerPulse::SampleRateInfoCallback(pa_context* context, |
| 340 const pa_server_info* info, | 359 const pa_server_info* info, |
| 341 void* user_data) { | 360 void* user_data) { |
| 342 AudioManagerPulse* manager = reinterpret_cast<AudioManagerPulse*>(user_data); | 361 AudioManagerPulse* manager = reinterpret_cast<AudioManagerPulse*>(user_data); |
| 343 | 362 |
| 344 manager->native_input_sample_rate_ = info->sample_spec.rate; | 363 manager->native_input_sample_rate_ = info->sample_spec.rate; |
| 345 pa_threaded_mainloop_signal(manager->input_mainloop_, 0); | 364 pa_threaded_mainloop_signal(manager->input_mainloop_, 0); |
| 346 } | 365 } |
| 347 | 366 |
| 348 } // namespace media | 367 } // namespace media |
| OLD | NEW |