| 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/pulse/pulse_output.h" | 5 #include "media/audio/pulse/pulse_output.h" |
| 6 | 6 |
| 7 #include <pulse/pulseaudio.h> | 7 #include <pulse/pulseaudio.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "media/audio/audio_device_description.h" |
| 11 #include "media/audio/audio_manager_base.h" | 12 #include "media/audio/audio_manager_base.h" |
| 12 #include "media/audio/pulse/pulse_util.h" | 13 #include "media/audio/pulse/pulse_util.h" |
| 13 | 14 |
| 14 namespace media { | 15 namespace media { |
| 15 | 16 |
| 16 using pulse::AutoPulseLock; | 17 using pulse::AutoPulseLock; |
| 17 using pulse::WaitForOperationCompletion; | 18 using pulse::WaitForOperationCompletion; |
| 18 | 19 |
| 19 // static, pa_stream_notify_cb | 20 // static, pa_stream_notify_cb |
| 20 void PulseAudioOutputStream::StreamNotifyCallback(pa_stream* s, void* p_this) { | 21 void PulseAudioOutputStream::StreamNotifyCallback(pa_stream* s, void* p_this) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 144 |
| 144 bool PulseAudioOutputStream::Open() { | 145 bool PulseAudioOutputStream::Open() { |
| 145 DCHECK(thread_checker_.CalledOnValidThread()); | 146 DCHECK(thread_checker_.CalledOnValidThread()); |
| 146 if (!InitializeMainloopAndContext()) { | 147 if (!InitializeMainloopAndContext()) { |
| 147 return false; | 148 return false; |
| 148 } | 149 } |
| 149 | 150 |
| 150 AutoPulseLock auto_lock(pa_mainloop_); | 151 AutoPulseLock auto_lock(pa_mainloop_); |
| 151 | 152 |
| 152 std::string device_name_to_use = device_id_; | 153 std::string device_name_to_use = device_id_; |
| 153 if (device_id_ == AudioManagerBase::kDefaultDeviceId) { | 154 if (device_id_ == AudioDeviceDescription::kDefaultDeviceId) { |
| 154 GetSystemDefaultOutputDevice(); | 155 GetSystemDefaultOutputDevice(); |
| 155 device_name_to_use = default_system_device_name_; | 156 device_name_to_use = default_system_device_name_; |
| 156 } | 157 } |
| 157 | 158 |
| 158 return pulse::CreateOutputStream( | 159 return pulse::CreateOutputStream( |
| 159 pa_mainloop_, pa_context_, &pa_stream_, params_, device_name_to_use, | 160 pa_mainloop_, pa_context_, &pa_stream_, params_, device_name_to_use, |
| 160 AudioManager::GetGlobalAppName(), &StreamNotifyCallback, | 161 AudioManager::GetGlobalAppName(), &StreamNotifyCallback, |
| 161 &StreamRequestCallback, this); | 162 &StreamRequestCallback, this); |
| 162 } | 163 } |
| 163 | 164 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 volume_ = static_cast<float>(volume); | 322 volume_ = static_cast<float>(volume); |
| 322 } | 323 } |
| 323 | 324 |
| 324 void PulseAudioOutputStream::GetVolume(double* volume) { | 325 void PulseAudioOutputStream::GetVolume(double* volume) { |
| 325 DCHECK(thread_checker_.CalledOnValidThread()); | 326 DCHECK(thread_checker_.CalledOnValidThread()); |
| 326 | 327 |
| 327 *volume = volume_; | 328 *volume = volume_; |
| 328 } | 329 } |
| 329 | 330 |
| 330 } // namespace media | 331 } // namespace media |
| OLD | NEW |