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 |
11 #include "webrtc/voice_engine/voe_hardware_impl.h" | 11 #include "webrtc/voice_engine/voe_hardware_impl.h" |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 | 14 |
15 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | |
16 #include "webrtc/system_wrappers/include/trace.h" | 15 #include "webrtc/system_wrappers/include/trace.h" |
17 #include "webrtc/voice_engine/include/voe_errors.h" | 16 #include "webrtc/voice_engine/include/voe_errors.h" |
18 #include "webrtc/voice_engine/voice_engine_impl.h" | 17 #include "webrtc/voice_engine/voice_engine_impl.h" |
19 | 18 |
20 namespace webrtc { | 19 namespace webrtc { |
21 | 20 |
22 VoEHardware* VoEHardware::GetInterface(VoiceEngine* voiceEngine) { | 21 VoEHardware* VoEHardware::GetInterface(VoiceEngine* voiceEngine) { |
23 #ifndef WEBRTC_VOICE_ENGINE_HARDWARE_API | 22 #ifndef WEBRTC_VOICE_ENGINE_HARDWARE_API |
24 return NULL; | 23 return NULL; |
25 #else | 24 #else |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 226 } |
228 | 227 |
229 return 0; | 228 return 0; |
230 } | 229 } |
231 | 230 |
232 int VoEHardwareImpl::SetRecordingDevice(int index, | 231 int VoEHardwareImpl::SetRecordingDevice(int index, |
233 StereoChannel recordingChannel) { | 232 StereoChannel recordingChannel) { |
234 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 233 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
235 "SetRecordingDevice(index=%d, recordingChannel=%d)", index, | 234 "SetRecordingDevice(index=%d, recordingChannel=%d)", index, |
236 (int)recordingChannel); | 235 (int)recordingChannel); |
237 CriticalSectionScoped cs(_shared->crit_sec()); | 236 rtc::CritScope cs(_shared->crit_sec()); |
238 | 237 |
239 if (!_shared->statistics().Initialized()) { | 238 if (!_shared->statistics().Initialized()) { |
240 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 239 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
241 return -1; | 240 return -1; |
242 } | 241 } |
243 | 242 |
244 bool isRecording(false); | 243 bool isRecording(false); |
245 | 244 |
246 // Store state about activated recording to be able to restore it after the | 245 // Store state about activated recording to be able to restore it after the |
247 // recording device has been modified. | 246 // recording device has been modified. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 return -1; | 337 return -1; |
339 } | 338 } |
340 } | 339 } |
341 | 340 |
342 return 0; | 341 return 0; |
343 } | 342 } |
344 | 343 |
345 int VoEHardwareImpl::SetPlayoutDevice(int index) { | 344 int VoEHardwareImpl::SetPlayoutDevice(int index) { |
346 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 345 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
347 "SetPlayoutDevice(index=%d)", index); | 346 "SetPlayoutDevice(index=%d)", index); |
348 CriticalSectionScoped cs(_shared->crit_sec()); | 347 rtc::CritScope cs(_shared->crit_sec()); |
349 | 348 |
350 if (!_shared->statistics().Initialized()) { | 349 if (!_shared->statistics().Initialized()) { |
351 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 350 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
352 return -1; | 351 return -1; |
353 } | 352 } |
354 | 353 |
355 bool isPlaying(false); | 354 bool isPlaying(false); |
356 | 355 |
357 // Store state about activated playout to be able to restore it after the | 356 // Store state about activated playout to be able to restore it after the |
358 // playout device has been modified. | 357 // playout device has been modified. |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 if (!_shared->statistics().Initialized()) { | 507 if (!_shared->statistics().Initialized()) { |
509 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 508 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
510 return -1; | 509 return -1; |
511 } | 510 } |
512 return _shared->audio_device()->EnableBuiltInNS(enable); | 511 return _shared->audio_device()->EnableBuiltInNS(enable); |
513 } | 512 } |
514 | 513 |
515 #endif // WEBRTC_VOICE_ENGINE_HARDWARE_API | 514 #endif // WEBRTC_VOICE_ENGINE_HARDWARE_API |
516 | 515 |
517 } // namespace webrtc | 516 } // namespace webrtc |
OLD | NEW |