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_audio_processing_impl.h" | 11 #include "webrtc/voice_engine/voe_audio_processing_impl.h" |
12 | 12 |
| 13 #include "webrtc/base/logging.h" |
13 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 14 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
14 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 15 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
15 #include "webrtc/system_wrappers/include/logging.h" | |
16 #include "webrtc/system_wrappers/include/trace.h" | 16 #include "webrtc/system_wrappers/include/trace.h" |
17 #include "webrtc/voice_engine/channel.h" | 17 #include "webrtc/voice_engine/channel.h" |
18 #include "webrtc/voice_engine/include/voe_errors.h" | 18 #include "webrtc/voice_engine/include/voe_errors.h" |
19 #include "webrtc/voice_engine/transmit_mixer.h" | 19 #include "webrtc/voice_engine/transmit_mixer.h" |
20 #include "webrtc/voice_engine/voice_engine_impl.h" | 20 #include "webrtc/voice_engine/voice_engine_impl.h" |
21 | 21 |
22 // TODO(andrew): move to a common place. | 22 // TODO(andrew): move to a common place. |
23 #define WEBRTC_VOICE_INIT_CHECK() \ | 23 #define WEBRTC_VOICE_INIT_CHECK() \ |
24 do { \ | 24 do { \ |
25 if (!_shared->statistics().Initialized()) { \ | 25 if (!_shared->statistics().Initialized()) { \ |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 #else | 310 #else |
311 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | 311 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, |
312 "GetAgcConfig() EC is not supported"); | 312 "GetAgcConfig() EC is not supported"); |
313 return -1; | 313 return -1; |
314 #endif | 314 #endif |
315 } | 315 } |
316 | 316 |
317 int VoEAudioProcessingImpl::SetRxNsStatus(int channel, | 317 int VoEAudioProcessingImpl::SetRxNsStatus(int channel, |
318 bool enable, | 318 bool enable, |
319 NsModes mode) { | 319 NsModes mode) { |
320 LOG_API3(channel, enable, mode); | |
321 #ifdef WEBRTC_VOICE_ENGINE_NR | 320 #ifdef WEBRTC_VOICE_ENGINE_NR |
322 if (!_shared->statistics().Initialized()) { | 321 if (!_shared->statistics().Initialized()) { |
323 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 322 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
324 return -1; | 323 return -1; |
325 } | 324 } |
326 | 325 |
327 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 326 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
328 voe::Channel* channelPtr = ch.channel(); | 327 voe::Channel* channelPtr = ch.channel(); |
329 if (channelPtr == NULL) { | 328 if (channelPtr == NULL) { |
330 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 329 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 | 461 |
463 bool VoEAudioProcessing::DriftCompensationSupported() { | 462 bool VoEAudioProcessing::DriftCompensationSupported() { |
464 #if defined(WEBRTC_DRIFT_COMPENSATION_SUPPORTED) | 463 #if defined(WEBRTC_DRIFT_COMPENSATION_SUPPORTED) |
465 return true; | 464 return true; |
466 #else | 465 #else |
467 return false; | 466 return false; |
468 #endif | 467 #endif |
469 } | 468 } |
470 | 469 |
471 int VoEAudioProcessingImpl::EnableDriftCompensation(bool enable) { | 470 int VoEAudioProcessingImpl::EnableDriftCompensation(bool enable) { |
472 LOG_API1(enable); | |
473 WEBRTC_VOICE_INIT_CHECK(); | 471 WEBRTC_VOICE_INIT_CHECK(); |
474 | 472 |
475 if (!DriftCompensationSupported()) { | 473 if (!DriftCompensationSupported()) { |
476 _shared->SetLastError( | 474 _shared->SetLastError( |
477 VE_APM_ERROR, kTraceWarning, | 475 VE_APM_ERROR, kTraceWarning, |
478 "Drift compensation is not supported on this platform."); | 476 "Drift compensation is not supported on this platform."); |
479 return -1; | 477 return -1; |
480 } | 478 } |
481 | 479 |
482 EchoCancellation* aec = _shared->audio_processing()->echo_cancellation(); | 480 EchoCancellation* aec = _shared->audio_processing()->echo_cancellation(); |
483 if (aec->enable_drift_compensation(enable) != 0) { | 481 if (aec->enable_drift_compensation(enable) != 0) { |
484 _shared->SetLastError(VE_APM_ERROR, kTraceError, | 482 _shared->SetLastError(VE_APM_ERROR, kTraceError, |
485 "aec->enable_drift_compensation() failed"); | 483 "aec->enable_drift_compensation() failed"); |
486 return -1; | 484 return -1; |
487 } | 485 } |
488 return 0; | 486 return 0; |
489 } | 487 } |
490 | 488 |
491 bool VoEAudioProcessingImpl::DriftCompensationEnabled() { | 489 bool VoEAudioProcessingImpl::DriftCompensationEnabled() { |
492 LOG_API0(); | |
493 WEBRTC_VOICE_INIT_CHECK_BOOL(); | 490 WEBRTC_VOICE_INIT_CHECK_BOOL(); |
494 | 491 |
495 EchoCancellation* aec = _shared->audio_processing()->echo_cancellation(); | 492 EchoCancellation* aec = _shared->audio_processing()->echo_cancellation(); |
496 return aec->is_drift_compensation_enabled(); | 493 return aec->is_drift_compensation_enabled(); |
497 } | 494 } |
498 | 495 |
499 int VoEAudioProcessingImpl::SetEcStatus(bool enable, EcModes mode) { | 496 int VoEAudioProcessingImpl::SetEcStatus(bool enable, EcModes mode) { |
500 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 497 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
501 "SetEcStatus(enable=%d, mode=%d)", enable, mode); | 498 "SetEcStatus(enable=%d, mode=%d)", enable, mode); |
502 #ifdef WEBRTC_VOICE_ENGINE_ECHO | 499 #ifdef WEBRTC_VOICE_ENGINE_ECHO |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 _shared->statistics().SetLastError(VE_NOT_INITED, kTraceError); | 1028 _shared->statistics().SetLastError(VE_NOT_INITED, kTraceError); |
1032 return -1; | 1029 return -1; |
1033 } | 1030 } |
1034 return (_shared->transmit_mixer()->SetTypingDetectionParameters( | 1031 return (_shared->transmit_mixer()->SetTypingDetectionParameters( |
1035 timeWindow, costPerTyping, reportingThreshold, penaltyDecay, | 1032 timeWindow, costPerTyping, reportingThreshold, penaltyDecay, |
1036 typeEventDelay)); | 1033 typeEventDelay)); |
1037 #endif | 1034 #endif |
1038 } | 1035 } |
1039 | 1036 |
1040 void VoEAudioProcessingImpl::EnableStereoChannelSwapping(bool enable) { | 1037 void VoEAudioProcessingImpl::EnableStereoChannelSwapping(bool enable) { |
1041 LOG_API1(enable); | |
1042 _shared->transmit_mixer()->EnableStereoChannelSwapping(enable); | 1038 _shared->transmit_mixer()->EnableStereoChannelSwapping(enable); |
1043 } | 1039 } |
1044 | 1040 |
1045 bool VoEAudioProcessingImpl::IsStereoChannelSwappingEnabled() { | 1041 bool VoEAudioProcessingImpl::IsStereoChannelSwappingEnabled() { |
1046 LOG_API0(); | |
1047 return _shared->transmit_mixer()->IsStereoChannelSwappingEnabled(); | 1042 return _shared->transmit_mixer()->IsStereoChannelSwappingEnabled(); |
1048 } | 1043 } |
1049 | 1044 |
1050 #endif // #ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API | 1045 #endif // #ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API |
1051 | 1046 |
1052 } // namespace webrtc | 1047 } // namespace webrtc |
OLD | NEW |