OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 _paSpeakerVolume(PA_VOLUME_NORM), | 56 _paSpeakerVolume(PA_VOLUME_NORM), |
57 _paChannels(0), | 57 _paChannels(0), |
58 _paObjectsSet(false) | 58 _paObjectsSet(false) |
59 { | 59 { |
60 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, | 60 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, |
61 "%s constructed", __FUNCTION__); | 61 "%s constructed", __FUNCTION__); |
62 } | 62 } |
63 | 63 |
64 AudioMixerManagerLinuxPulse::~AudioMixerManagerLinuxPulse() | 64 AudioMixerManagerLinuxPulse::~AudioMixerManagerLinuxPulse() |
65 { | 65 { |
66 DCHECK(thread_checker_.CalledOnValidThread()); | 66 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
67 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, | 67 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, |
68 "%s destructed", __FUNCTION__); | 68 "%s destructed", __FUNCTION__); |
69 | 69 |
70 Close(); | 70 Close(); |
71 } | 71 } |
72 | 72 |
73 // =========================================================================== | 73 // =========================================================================== |
74 // PUBLIC METHODS | 74 // PUBLIC METHODS |
75 // =========================================================================== | 75 // =========================================================================== |
76 | 76 |
77 int32_t AudioMixerManagerLinuxPulse::SetPulseAudioObjects( | 77 int32_t AudioMixerManagerLinuxPulse::SetPulseAudioObjects( |
78 pa_threaded_mainloop* mainloop, | 78 pa_threaded_mainloop* mainloop, |
79 pa_context* context) | 79 pa_context* context) |
80 { | 80 { |
81 DCHECK(thread_checker_.CalledOnValidThread()); | 81 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
82 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", | 82 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", |
83 __FUNCTION__); | 83 __FUNCTION__); |
84 | 84 |
85 if (!mainloop || !context) | 85 if (!mainloop || !context) |
86 { | 86 { |
87 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 87 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, |
88 " could not set PulseAudio objects for mixer"); | 88 " could not set PulseAudio objects for mixer"); |
89 return -1; | 89 return -1; |
90 } | 90 } |
91 | 91 |
92 _paMainloop = mainloop; | 92 _paMainloop = mainloop; |
93 _paContext = context; | 93 _paContext = context; |
94 _paObjectsSet = true; | 94 _paObjectsSet = true; |
95 | 95 |
96 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 96 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, |
97 " the PulseAudio objects for the mixer has been set"); | 97 " the PulseAudio objects for the mixer has been set"); |
98 | 98 |
99 return 0; | 99 return 0; |
100 } | 100 } |
101 | 101 |
102 int32_t AudioMixerManagerLinuxPulse::Close() | 102 int32_t AudioMixerManagerLinuxPulse::Close() |
103 { | 103 { |
104 DCHECK(thread_checker_.CalledOnValidThread()); | 104 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
105 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", | 105 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", |
106 __FUNCTION__); | 106 __FUNCTION__); |
107 | 107 |
108 CloseSpeaker(); | 108 CloseSpeaker(); |
109 CloseMicrophone(); | 109 CloseMicrophone(); |
110 | 110 |
111 _paMainloop = NULL; | 111 _paMainloop = NULL; |
112 _paContext = NULL; | 112 _paContext = NULL; |
113 _paObjectsSet = false; | 113 _paObjectsSet = false; |
114 | 114 |
115 return 0; | 115 return 0; |
116 | 116 |
117 } | 117 } |
118 | 118 |
119 int32_t AudioMixerManagerLinuxPulse::CloseSpeaker() | 119 int32_t AudioMixerManagerLinuxPulse::CloseSpeaker() |
120 { | 120 { |
121 DCHECK(thread_checker_.CalledOnValidThread()); | 121 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
122 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", | 122 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", |
123 __FUNCTION__); | 123 __FUNCTION__); |
124 | 124 |
125 // Reset the index to -1 | 125 // Reset the index to -1 |
126 _paOutputDeviceIndex = -1; | 126 _paOutputDeviceIndex = -1; |
127 _paPlayStream = NULL; | 127 _paPlayStream = NULL; |
128 | 128 |
129 return 0; | 129 return 0; |
130 } | 130 } |
131 | 131 |
132 int32_t AudioMixerManagerLinuxPulse::CloseMicrophone() | 132 int32_t AudioMixerManagerLinuxPulse::CloseMicrophone() |
133 { | 133 { |
134 DCHECK(thread_checker_.CalledOnValidThread()); | 134 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
135 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", | 135 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", |
136 __FUNCTION__); | 136 __FUNCTION__); |
137 | 137 |
138 // Reset the index to -1 | 138 // Reset the index to -1 |
139 _paInputDeviceIndex = -1; | 139 _paInputDeviceIndex = -1; |
140 _paRecStream = NULL; | 140 _paRecStream = NULL; |
141 | 141 |
142 return 0; | 142 return 0; |
143 } | 143 } |
144 | 144 |
145 int32_t AudioMixerManagerLinuxPulse::SetPlayStream(pa_stream* playStream) | 145 int32_t AudioMixerManagerLinuxPulse::SetPlayStream(pa_stream* playStream) |
146 { | 146 { |
147 DCHECK(thread_checker_.CalledOnValidThread()); | 147 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
148 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 148 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, |
149 "AudioMixerManagerLinuxPulse::SetPlayStream(playStream)"); | 149 "AudioMixerManagerLinuxPulse::SetPlayStream(playStream)"); |
150 | 150 |
151 _paPlayStream = playStream; | 151 _paPlayStream = playStream; |
152 return 0; | 152 return 0; |
153 } | 153 } |
154 | 154 |
155 int32_t AudioMixerManagerLinuxPulse::SetRecStream(pa_stream* recStream) | 155 int32_t AudioMixerManagerLinuxPulse::SetRecStream(pa_stream* recStream) |
156 { | 156 { |
157 DCHECK(thread_checker_.CalledOnValidThread()); | 157 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
158 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 158 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, |
159 "AudioMixerManagerLinuxPulse::SetRecStream(recStream)"); | 159 "AudioMixerManagerLinuxPulse::SetRecStream(recStream)"); |
160 | 160 |
161 _paRecStream = recStream; | 161 _paRecStream = recStream; |
162 return 0; | 162 return 0; |
163 } | 163 } |
164 | 164 |
165 int32_t AudioMixerManagerLinuxPulse::OpenSpeaker( | 165 int32_t AudioMixerManagerLinuxPulse::OpenSpeaker( |
166 uint16_t deviceIndex) | 166 uint16_t deviceIndex) |
167 { | 167 { |
168 DCHECK(thread_checker_.CalledOnValidThread()); | 168 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
169 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 169 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, |
170 "AudioMixerManagerLinuxPulse::OpenSpeaker(deviceIndex=%d)", | 170 "AudioMixerManagerLinuxPulse::OpenSpeaker(deviceIndex=%d)", |
171 deviceIndex); | 171 deviceIndex); |
172 | 172 |
173 // No point in opening the speaker | 173 // No point in opening the speaker |
174 // if PA objects have not been set | 174 // if PA objects have not been set |
175 if (!_paObjectsSet) | 175 if (!_paObjectsSet) |
176 { | 176 { |
177 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 177 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, |
178 " PulseAudio objects has not been set"); | 178 " PulseAudio objects has not been set"); |
179 return -1; | 179 return -1; |
180 } | 180 } |
181 | 181 |
182 // Set the index for the PulseAudio | 182 // Set the index for the PulseAudio |
183 // output device to control | 183 // output device to control |
184 _paOutputDeviceIndex = deviceIndex; | 184 _paOutputDeviceIndex = deviceIndex; |
185 | 185 |
186 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 186 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, |
187 " the output mixer device is now open"); | 187 " the output mixer device is now open"); |
188 | 188 |
189 return 0; | 189 return 0; |
190 } | 190 } |
191 | 191 |
192 int32_t AudioMixerManagerLinuxPulse::OpenMicrophone( | 192 int32_t AudioMixerManagerLinuxPulse::OpenMicrophone( |
193 uint16_t deviceIndex) | 193 uint16_t deviceIndex) |
194 { | 194 { |
195 DCHECK(thread_checker_.CalledOnValidThread()); | 195 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
196 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 196 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, |
197 "AudioMixerManagerLinuxPulse::OpenMicrophone" | 197 "AudioMixerManagerLinuxPulse::OpenMicrophone" |
198 "(deviceIndex=%d)", deviceIndex); | 198 "(deviceIndex=%d)", deviceIndex); |
199 | 199 |
200 // No point in opening the microphone | 200 // No point in opening the microphone |
201 // if PA objects have not been set | 201 // if PA objects have not been set |
202 if (!_paObjectsSet) | 202 if (!_paObjectsSet) |
203 { | 203 { |
204 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 204 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, |
205 " PulseAudio objects have not been set"); | 205 " PulseAudio objects have not been set"); |
206 return -1; | 206 return -1; |
207 } | 207 } |
208 | 208 |
209 // Set the index for the PulseAudio | 209 // Set the index for the PulseAudio |
210 // input device to control | 210 // input device to control |
211 _paInputDeviceIndex = deviceIndex; | 211 _paInputDeviceIndex = deviceIndex; |
212 | 212 |
213 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 213 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, |
214 " the input mixer device is now open"); | 214 " the input mixer device is now open"); |
215 | 215 |
216 return 0; | 216 return 0; |
217 } | 217 } |
218 | 218 |
219 bool AudioMixerManagerLinuxPulse::SpeakerIsInitialized() const | 219 bool AudioMixerManagerLinuxPulse::SpeakerIsInitialized() const |
220 { | 220 { |
221 DCHECK(thread_checker_.CalledOnValidThread()); | 221 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
222 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", | 222 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", |
223 __FUNCTION__); | 223 __FUNCTION__); |
224 | 224 |
225 return (_paOutputDeviceIndex != -1); | 225 return (_paOutputDeviceIndex != -1); |
226 } | 226 } |
227 | 227 |
228 bool AudioMixerManagerLinuxPulse::MicrophoneIsInitialized() const | 228 bool AudioMixerManagerLinuxPulse::MicrophoneIsInitialized() const |
229 { | 229 { |
230 DCHECK(thread_checker_.CalledOnValidThread()); | 230 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
231 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", | 231 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", |
232 __FUNCTION__); | 232 __FUNCTION__); |
233 | 233 |
234 return (_paInputDeviceIndex != -1); | 234 return (_paInputDeviceIndex != -1); |
235 } | 235 } |
236 | 236 |
237 int32_t AudioMixerManagerLinuxPulse::SetSpeakerVolume( | 237 int32_t AudioMixerManagerLinuxPulse::SetSpeakerVolume( |
238 uint32_t volume) | 238 uint32_t volume) |
239 { | 239 { |
240 DCHECK(thread_checker_.CalledOnValidThread()); | 240 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
241 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 241 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, |
242 "AudioMixerManagerLinuxPulse::SetSpeakerVolume(volume=%u)", | 242 "AudioMixerManagerLinuxPulse::SetSpeakerVolume(volume=%u)", |
243 volume); | 243 volume); |
244 | 244 |
245 if (_paOutputDeviceIndex == -1) | 245 if (_paOutputDeviceIndex == -1) |
246 { | 246 { |
247 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 247 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
248 " output device index has not been set"); | 248 " output device index has not been set"); |
249 return -1; | 249 return -1; |
250 } | 250 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 } | 365 } |
366 | 366 |
367 minVolume = static_cast<uint32_t> (PA_VOLUME_MUTED); | 367 minVolume = static_cast<uint32_t> (PA_VOLUME_MUTED); |
368 | 368 |
369 return 0; | 369 return 0; |
370 } | 370 } |
371 | 371 |
372 int32_t | 372 int32_t |
373 AudioMixerManagerLinuxPulse::SpeakerVolumeStepSize(uint16_t& stepSize) const | 373 AudioMixerManagerLinuxPulse::SpeakerVolumeStepSize(uint16_t& stepSize) const |
374 { | 374 { |
375 DCHECK(thread_checker_.CalledOnValidThread()); | 375 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
376 if (_paOutputDeviceIndex == -1) | 376 if (_paOutputDeviceIndex == -1) |
377 { | 377 { |
378 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 378 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
379 " output device index has not been set"); | 379 " output device index has not been set"); |
380 return -1; | 380 return -1; |
381 } | 381 } |
382 | 382 |
383 // The sink input (stream) will always have step size = 1 | 383 // The sink input (stream) will always have step size = 1 |
384 // There are PA_VOLUME_NORM+1 steps | 384 // There are PA_VOLUME_NORM+1 steps |
385 stepSize = 1; | 385 stepSize = 1; |
386 | 386 |
387 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 387 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, |
388 "\tAudioMixerManagerLinuxPulse::SpeakerVolumeStepSize() => " | 388 "\tAudioMixerManagerLinuxPulse::SpeakerVolumeStepSize() => " |
389 "size=%i", stepSize); | 389 "size=%i", stepSize); |
390 | 390 |
391 return 0; | 391 return 0; |
392 } | 392 } |
393 | 393 |
394 int32_t | 394 int32_t |
395 AudioMixerManagerLinuxPulse::SpeakerVolumeIsAvailable(bool& available) | 395 AudioMixerManagerLinuxPulse::SpeakerVolumeIsAvailable(bool& available) |
396 { | 396 { |
397 DCHECK(thread_checker_.CalledOnValidThread()); | 397 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
398 if (_paOutputDeviceIndex == -1) | 398 if (_paOutputDeviceIndex == -1) |
399 { | 399 { |
400 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 400 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
401 " output device index has not been set"); | 401 " output device index has not been set"); |
402 return -1; | 402 return -1; |
403 } | 403 } |
404 | 404 |
405 // Always available in Pulse Audio | 405 // Always available in Pulse Audio |
406 available = true; | 406 available = true; |
407 | 407 |
408 return 0; | 408 return 0; |
409 } | 409 } |
410 | 410 |
411 int32_t | 411 int32_t |
412 AudioMixerManagerLinuxPulse::SpeakerMuteIsAvailable(bool& available) | 412 AudioMixerManagerLinuxPulse::SpeakerMuteIsAvailable(bool& available) |
413 { | 413 { |
414 DCHECK(thread_checker_.CalledOnValidThread()); | 414 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
415 if (_paOutputDeviceIndex == -1) | 415 if (_paOutputDeviceIndex == -1) |
416 { | 416 { |
417 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 417 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
418 " output device index has not been set"); | 418 " output device index has not been set"); |
419 return -1; | 419 return -1; |
420 } | 420 } |
421 | 421 |
422 // Always available in Pulse Audio | 422 // Always available in Pulse Audio |
423 available = true; | 423 available = true; |
424 | 424 |
425 return 0; | 425 return 0; |
426 } | 426 } |
427 | 427 |
428 int32_t AudioMixerManagerLinuxPulse::SetSpeakerMute(bool enable) | 428 int32_t AudioMixerManagerLinuxPulse::SetSpeakerMute(bool enable) |
429 { | 429 { |
430 DCHECK(thread_checker_.CalledOnValidThread()); | 430 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
431 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 431 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, |
432 "AudioMixerManagerLinuxPulse::SetSpeakerMute(enable=%u)", | 432 "AudioMixerManagerLinuxPulse::SetSpeakerMute(enable=%u)", |
433 enable); | 433 enable); |
434 | 434 |
435 if (_paOutputDeviceIndex == -1) | 435 if (_paOutputDeviceIndex == -1) |
436 { | 436 { |
437 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 437 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
438 " output device index has not been set"); | 438 " output device index has not been set"); |
439 return -1; | 439 return -1; |
440 } | 440 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 505 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, |
506 " AudioMixerManagerLinuxPulse::SpeakerMute() => " | 506 " AudioMixerManagerLinuxPulse::SpeakerMute() => " |
507 "enabled=%i, enabled"); | 507 "enabled=%i, enabled"); |
508 | 508 |
509 return 0; | 509 return 0; |
510 } | 510 } |
511 | 511 |
512 int32_t | 512 int32_t |
513 AudioMixerManagerLinuxPulse::StereoPlayoutIsAvailable(bool& available) | 513 AudioMixerManagerLinuxPulse::StereoPlayoutIsAvailable(bool& available) |
514 { | 514 { |
515 DCHECK(thread_checker_.CalledOnValidThread()); | 515 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
516 if (_paOutputDeviceIndex == -1) | 516 if (_paOutputDeviceIndex == -1) |
517 { | 517 { |
518 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 518 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
519 " output device index has not been set"); | 519 " output device index has not been set"); |
520 return -1; | 520 return -1; |
521 } | 521 } |
522 | 522 |
523 uint32_t deviceIndex = (uint32_t) _paOutputDeviceIndex; | 523 uint32_t deviceIndex = (uint32_t) _paOutputDeviceIndex; |
524 | 524 |
525 { | 525 { |
(...skipping 13 matching lines...) Expand all Loading... |
539 return -1; | 539 return -1; |
540 | 540 |
541 available = static_cast<bool> (_paChannels == 2); | 541 available = static_cast<bool> (_paChannels == 2); |
542 | 542 |
543 return 0; | 543 return 0; |
544 } | 544 } |
545 | 545 |
546 int32_t | 546 int32_t |
547 AudioMixerManagerLinuxPulse::StereoRecordingIsAvailable(bool& available) | 547 AudioMixerManagerLinuxPulse::StereoRecordingIsAvailable(bool& available) |
548 { | 548 { |
549 DCHECK(thread_checker_.CalledOnValidThread()); | 549 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
550 if (_paInputDeviceIndex == -1) | 550 if (_paInputDeviceIndex == -1) |
551 { | 551 { |
552 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 552 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
553 " input device index has not been set"); | 553 " input device index has not been set"); |
554 return -1; | 554 return -1; |
555 } | 555 } |
556 | 556 |
557 uint32_t deviceIndex = (uint32_t) _paInputDeviceIndex; | 557 uint32_t deviceIndex = (uint32_t) _paInputDeviceIndex; |
558 | 558 |
559 AutoPulseLock auto_lock(_paMainloop); | 559 AutoPulseLock auto_lock(_paMainloop); |
(...skipping 23 matching lines...) Expand all Loading... |
583 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 583 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, |
584 " AudioMixerManagerLinuxPulse::StereoRecordingIsAvailable()" | 584 " AudioMixerManagerLinuxPulse::StereoRecordingIsAvailable()" |
585 " => available=%i, available"); | 585 " => available=%i, available"); |
586 | 586 |
587 return 0; | 587 return 0; |
588 } | 588 } |
589 | 589 |
590 int32_t AudioMixerManagerLinuxPulse::MicrophoneMuteIsAvailable( | 590 int32_t AudioMixerManagerLinuxPulse::MicrophoneMuteIsAvailable( |
591 bool& available) | 591 bool& available) |
592 { | 592 { |
593 DCHECK(thread_checker_.CalledOnValidThread()); | 593 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
594 if (_paInputDeviceIndex == -1) | 594 if (_paInputDeviceIndex == -1) |
595 { | 595 { |
596 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 596 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
597 " input device index has not been set"); | 597 " input device index has not been set"); |
598 return -1; | 598 return -1; |
599 } | 599 } |
600 | 600 |
601 // Always available in Pulse Audio | 601 // Always available in Pulse Audio |
602 available = true; | 602 available = true; |
603 | 603 |
604 return 0; | 604 return 0; |
605 } | 605 } |
606 | 606 |
607 int32_t AudioMixerManagerLinuxPulse::SetMicrophoneMute(bool enable) | 607 int32_t AudioMixerManagerLinuxPulse::SetMicrophoneMute(bool enable) |
608 { | 608 { |
609 DCHECK(thread_checker_.CalledOnValidThread()); | 609 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
610 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 610 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, |
611 "AudioMixerManagerLinuxPulse::SetMicrophoneMute(enable=%u)", | 611 "AudioMixerManagerLinuxPulse::SetMicrophoneMute(enable=%u)", |
612 enable); | 612 enable); |
613 | 613 |
614 if (_paInputDeviceIndex == -1) | 614 if (_paInputDeviceIndex == -1) |
615 { | 615 { |
616 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 616 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
617 " input device index has not been set"); | 617 " input device index has not been set"); |
618 return -1; | 618 return -1; |
619 } | 619 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 " could not mute microphone, error%d", | 654 " could not mute microphone, error%d", |
655 LATE(pa_context_errno)(_paContext)); | 655 LATE(pa_context_errno)(_paContext)); |
656 return -1; | 656 return -1; |
657 } | 657 } |
658 | 658 |
659 return 0; | 659 return 0; |
660 } | 660 } |
661 | 661 |
662 int32_t AudioMixerManagerLinuxPulse::MicrophoneMute(bool& enabled) const | 662 int32_t AudioMixerManagerLinuxPulse::MicrophoneMute(bool& enabled) const |
663 { | 663 { |
664 DCHECK(thread_checker_.CalledOnValidThread()); | 664 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
665 if (_paInputDeviceIndex == -1) | 665 if (_paInputDeviceIndex == -1) |
666 { | 666 { |
667 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 667 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
668 " input device index has not been set"); | 668 " input device index has not been set"); |
669 return -1; | 669 return -1; |
670 } | 670 } |
671 | 671 |
672 uint32_t deviceIndex = (uint32_t) _paInputDeviceIndex; | 672 uint32_t deviceIndex = (uint32_t) _paInputDeviceIndex; |
673 | 673 |
674 { | 674 { |
(...skipping 16 matching lines...) Expand all Loading... |
691 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 691 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, |
692 "\tAudioMixerManagerLinuxPulse::MicrophoneMute() =>" | 692 "\tAudioMixerManagerLinuxPulse::MicrophoneMute() =>" |
693 " enabled=%i", enabled); | 693 " enabled=%i", enabled); |
694 | 694 |
695 return 0; | 695 return 0; |
696 } | 696 } |
697 | 697 |
698 int32_t | 698 int32_t |
699 AudioMixerManagerLinuxPulse::MicrophoneBoostIsAvailable(bool& available) | 699 AudioMixerManagerLinuxPulse::MicrophoneBoostIsAvailable(bool& available) |
700 { | 700 { |
701 DCHECK(thread_checker_.CalledOnValidThread()); | 701 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
702 if (_paInputDeviceIndex == -1) | 702 if (_paInputDeviceIndex == -1) |
703 { | 703 { |
704 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 704 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
705 " input device index has not been set"); | 705 " input device index has not been set"); |
706 return -1; | 706 return -1; |
707 } | 707 } |
708 | 708 |
709 // Always unavailable in Pulse Audio | 709 // Always unavailable in Pulse Audio |
710 // Could make it possible to use PA_VOLUME_MAX | 710 // Could make it possible to use PA_VOLUME_MAX |
711 // but that gives bad audio with some sound cards | 711 // but that gives bad audio with some sound cards |
712 available = false; | 712 available = false; |
713 | 713 |
714 return 0; | 714 return 0; |
715 } | 715 } |
716 | 716 |
717 int32_t AudioMixerManagerLinuxPulse::SetMicrophoneBoost(bool enable) | 717 int32_t AudioMixerManagerLinuxPulse::SetMicrophoneBoost(bool enable) |
718 { | 718 { |
719 DCHECK(thread_checker_.CalledOnValidThread()); | 719 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
720 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 720 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, |
721 "AudioMixerManagerLinuxPulse::SetMicrophoneBoost(enable=%u)", | 721 "AudioMixerManagerLinuxPulse::SetMicrophoneBoost(enable=%u)", |
722 enable); | 722 enable); |
723 | 723 |
724 if (_paInputDeviceIndex == -1) | 724 if (_paInputDeviceIndex == -1) |
725 { | 725 { |
726 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 726 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
727 " input device index has not been set"); | 727 " input device index has not been set"); |
728 return -1; | 728 return -1; |
729 } | 729 } |
730 | 730 |
731 // Ensure the selected microphone destination has a valid boost control | 731 // Ensure the selected microphone destination has a valid boost control |
732 bool available(false); | 732 bool available(false); |
733 MicrophoneBoostIsAvailable(available); | 733 MicrophoneBoostIsAvailable(available); |
734 if (!available) | 734 if (!available) |
735 { | 735 { |
736 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 736 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
737 " it is not possible to enable microphone boost"); | 737 " it is not possible to enable microphone boost"); |
738 return -1; | 738 return -1; |
739 } | 739 } |
740 | 740 |
741 // It is assumed that the call above fails! | 741 // It is assumed that the call above fails! |
742 | 742 |
743 return 0; | 743 return 0; |
744 } | 744 } |
745 | 745 |
746 int32_t AudioMixerManagerLinuxPulse::MicrophoneBoost(bool& enabled) const | 746 int32_t AudioMixerManagerLinuxPulse::MicrophoneBoost(bool& enabled) const |
747 { | 747 { |
748 DCHECK(thread_checker_.CalledOnValidThread()); | 748 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
749 if (_paInputDeviceIndex == -1) | 749 if (_paInputDeviceIndex == -1) |
750 { | 750 { |
751 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 751 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
752 " input device index has not been set"); | 752 " input device index has not been set"); |
753 return -1; | 753 return -1; |
754 } | 754 } |
755 | 755 |
756 // Microphone boost cannot be enabled on this platform! | 756 // Microphone boost cannot be enabled on this platform! |
757 enabled = false; | 757 enabled = false; |
758 | 758 |
759 return 0; | 759 return 0; |
760 } | 760 } |
761 | 761 |
762 int32_t AudioMixerManagerLinuxPulse::MicrophoneVolumeIsAvailable( | 762 int32_t AudioMixerManagerLinuxPulse::MicrophoneVolumeIsAvailable( |
763 bool& available) | 763 bool& available) |
764 { | 764 { |
765 DCHECK(thread_checker_.CalledOnValidThread()); | 765 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
766 if (_paInputDeviceIndex == -1) | 766 if (_paInputDeviceIndex == -1) |
767 { | 767 { |
768 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 768 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
769 " input device index has not been set"); | 769 " input device index has not been set"); |
770 return -1; | 770 return -1; |
771 } | 771 } |
772 | 772 |
773 // Always available in Pulse Audio | 773 // Always available in Pulse Audio |
774 available = true; | 774 available = true; |
775 | 775 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 } | 924 } |
925 | 925 |
926 minVolume = static_cast<uint32_t> (PA_VOLUME_MUTED); | 926 minVolume = static_cast<uint32_t> (PA_VOLUME_MUTED); |
927 | 927 |
928 return 0; | 928 return 0; |
929 } | 929 } |
930 | 930 |
931 int32_t AudioMixerManagerLinuxPulse::MicrophoneVolumeStepSize( | 931 int32_t AudioMixerManagerLinuxPulse::MicrophoneVolumeStepSize( |
932 uint16_t& stepSize) const | 932 uint16_t& stepSize) const |
933 { | 933 { |
934 DCHECK(thread_checker_.CalledOnValidThread()); | 934 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
935 if (_paInputDeviceIndex == -1) | 935 if (_paInputDeviceIndex == -1) |
936 { | 936 { |
937 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 937 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
938 " input device index has not been set"); | 938 " input device index has not been set"); |
939 return -1; | 939 return -1; |
940 } | 940 } |
941 | 941 |
942 uint32_t deviceIndex = (uint32_t) _paInputDeviceIndex; | 942 uint32_t deviceIndex = (uint32_t) _paInputDeviceIndex; |
943 | 943 |
944 AutoPulseLock auto_lock(_paMainloop); | 944 AutoPulseLock auto_lock(_paMainloop); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 | 1145 |
1146 AutoPulseLock auto_lock(_paMainloop); | 1146 AutoPulseLock auto_lock(_paMainloop); |
1147 paOperation = LATE(pa_context_get_source_info_by_index)( | 1147 paOperation = LATE(pa_context_get_source_info_by_index)( |
1148 _paContext, device_index, PaSourceInfoCallback, (void*) this); | 1148 _paContext, device_index, PaSourceInfoCallback, (void*) this); |
1149 | 1149 |
1150 WaitForOperationCompletion(paOperation); | 1150 WaitForOperationCompletion(paOperation); |
1151 return true; | 1151 return true; |
1152 } | 1152 } |
1153 | 1153 |
1154 } | 1154 } |
OLD | NEW |