| 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 _shared->audio_processing()->gain_control()->is_limiter_enabled(); | 306 _shared->audio_processing()->gain_control()->is_limiter_enabled(); |
| 307 | 307 |
| 308 return 0; | 308 return 0; |
| 309 #else | 309 #else |
| 310 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | 310 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, |
| 311 "GetAgcConfig() EC is not supported"); | 311 "GetAgcConfig() EC is not supported"); |
| 312 return -1; | 312 return -1; |
| 313 #endif | 313 #endif |
| 314 } | 314 } |
| 315 | 315 |
| 316 int VoEAudioProcessingImpl::SetRxNsStatus(int channel, | |
| 317 bool enable, | |
| 318 NsModes mode) { | |
| 319 #ifdef WEBRTC_VOICE_ENGINE_NR | |
| 320 if (!_shared->statistics().Initialized()) { | |
| 321 _shared->SetLastError(VE_NOT_INITED, kTraceError); | |
| 322 return -1; | |
| 323 } | |
| 324 | |
| 325 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | |
| 326 voe::Channel* channelPtr = ch.channel(); | |
| 327 if (channelPtr == NULL) { | |
| 328 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | |
| 329 "SetRxNsStatus() failed to locate channel"); | |
| 330 return -1; | |
| 331 } | |
| 332 return channelPtr->SetRxNsStatus(enable, mode); | |
| 333 #else | |
| 334 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
| 335 "SetRxNsStatus() NS is not supported"); | |
| 336 return -1; | |
| 337 #endif | |
| 338 } | |
| 339 | |
| 340 int VoEAudioProcessingImpl::GetRxNsStatus(int channel, | |
| 341 bool& enabled, | |
| 342 NsModes& mode) { | |
| 343 #ifdef WEBRTC_VOICE_ENGINE_NR | |
| 344 if (!_shared->statistics().Initialized()) { | |
| 345 _shared->SetLastError(VE_NOT_INITED, kTraceError); | |
| 346 return -1; | |
| 347 } | |
| 348 | |
| 349 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | |
| 350 voe::Channel* channelPtr = ch.channel(); | |
| 351 if (channelPtr == NULL) { | |
| 352 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | |
| 353 "GetRxNsStatus() failed to locate channel"); | |
| 354 return -1; | |
| 355 } | |
| 356 return channelPtr->GetRxNsStatus(enabled, mode); | |
| 357 #else | |
| 358 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
| 359 "GetRxNsStatus() NS is not supported"); | |
| 360 return -1; | |
| 361 #endif | |
| 362 } | |
| 363 | |
| 364 int VoEAudioProcessingImpl::SetRxAgcStatus(int channel, | |
| 365 bool enable, | |
| 366 AgcModes mode) { | |
| 367 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
| 368 "SetRxAgcStatus(channel=%d, enable=%d, mode=%d)", channel, | |
| 369 (int)enable, (int)mode); | |
| 370 #ifdef WEBRTC_VOICE_ENGINE_AGC | |
| 371 if (!_shared->statistics().Initialized()) { | |
| 372 _shared->SetLastError(VE_NOT_INITED, kTraceError); | |
| 373 return -1; | |
| 374 } | |
| 375 | |
| 376 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | |
| 377 voe::Channel* channelPtr = ch.channel(); | |
| 378 if (channelPtr == NULL) { | |
| 379 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | |
| 380 "SetRxAgcStatus() failed to locate channel"); | |
| 381 return -1; | |
| 382 } | |
| 383 return channelPtr->SetRxAgcStatus(enable, mode); | |
| 384 #else | |
| 385 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
| 386 "SetRxAgcStatus() Agc is not supported"); | |
| 387 return -1; | |
| 388 #endif | |
| 389 } | |
| 390 | |
| 391 int VoEAudioProcessingImpl::GetRxAgcStatus(int channel, | |
| 392 bool& enabled, | |
| 393 AgcModes& mode) { | |
| 394 #ifdef WEBRTC_VOICE_ENGINE_AGC | |
| 395 if (!_shared->statistics().Initialized()) { | |
| 396 _shared->SetLastError(VE_NOT_INITED, kTraceError); | |
| 397 return -1; | |
| 398 } | |
| 399 | |
| 400 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | |
| 401 voe::Channel* channelPtr = ch.channel(); | |
| 402 if (channelPtr == NULL) { | |
| 403 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | |
| 404 "GetRxAgcStatus() failed to locate channel"); | |
| 405 return -1; | |
| 406 } | |
| 407 return channelPtr->GetRxAgcStatus(enabled, mode); | |
| 408 #else | |
| 409 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
| 410 "GetRxAgcStatus() Agc is not supported"); | |
| 411 return -1; | |
| 412 #endif | |
| 413 } | |
| 414 | |
| 415 int VoEAudioProcessingImpl::SetRxAgcConfig(int channel, AgcConfig config) { | |
| 416 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
| 417 "SetRxAgcConfig(channel=%d)", channel); | |
| 418 #ifdef WEBRTC_VOICE_ENGINE_AGC | |
| 419 if (!_shared->statistics().Initialized()) { | |
| 420 _shared->SetLastError(VE_NOT_INITED, kTraceError); | |
| 421 return -1; | |
| 422 } | |
| 423 | |
| 424 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | |
| 425 voe::Channel* channelPtr = ch.channel(); | |
| 426 if (channelPtr == NULL) { | |
| 427 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | |
| 428 "SetRxAgcConfig() failed to locate channel"); | |
| 429 return -1; | |
| 430 } | |
| 431 return channelPtr->SetRxAgcConfig(config); | |
| 432 #else | |
| 433 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
| 434 "SetRxAgcConfig() Agc is not supported"); | |
| 435 return -1; | |
| 436 #endif | |
| 437 } | |
| 438 | |
| 439 int VoEAudioProcessingImpl::GetRxAgcConfig(int channel, AgcConfig& config) { | |
| 440 #ifdef WEBRTC_VOICE_ENGINE_AGC | |
| 441 if (!_shared->statistics().Initialized()) { | |
| 442 _shared->SetLastError(VE_NOT_INITED, kTraceError); | |
| 443 return -1; | |
| 444 } | |
| 445 | |
| 446 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | |
| 447 voe::Channel* channelPtr = ch.channel(); | |
| 448 if (channelPtr == NULL) { | |
| 449 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | |
| 450 "GetRxAgcConfig() failed to locate channel"); | |
| 451 return -1; | |
| 452 } | |
| 453 return channelPtr->GetRxAgcConfig(config); | |
| 454 #else | |
| 455 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
| 456 "GetRxAgcConfig() Agc is not supported"); | |
| 457 return -1; | |
| 458 #endif | |
| 459 } | |
| 460 | |
| 461 bool VoEAudioProcessing::DriftCompensationSupported() { | 316 bool VoEAudioProcessing::DriftCompensationSupported() { |
| 462 #if defined(WEBRTC_DRIFT_COMPENSATION_SUPPORTED) | 317 #if defined(WEBRTC_DRIFT_COMPENSATION_SUPPORTED) |
| 463 return true; | 318 return true; |
| 464 #else | 319 #else |
| 465 return false; | 320 return false; |
| 466 #endif | 321 #endif |
| 467 } | 322 } |
| 468 | 323 |
| 469 int VoEAudioProcessingImpl::EnableDriftCompensation(bool enable) { | 324 int VoEAudioProcessingImpl::EnableDriftCompensation(bool enable) { |
| 470 WEBRTC_VOICE_INIT_CHECK(); | 325 WEBRTC_VOICE_INIT_CHECK(); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 return -1; | 572 return -1; |
| 718 } | 573 } |
| 719 | 574 |
| 720 return 0; | 575 return 0; |
| 721 } | 576 } |
| 722 | 577 |
| 723 bool VoEAudioProcessingImpl::IsHighPassFilterEnabled() { | 578 bool VoEAudioProcessingImpl::IsHighPassFilterEnabled() { |
| 724 return _shared->audio_processing()->high_pass_filter()->is_enabled(); | 579 return _shared->audio_processing()->high_pass_filter()->is_enabled(); |
| 725 } | 580 } |
| 726 | 581 |
| 727 int VoEAudioProcessingImpl::RegisterRxVadObserver(int channel, | |
| 728 VoERxVadCallback& observer) { | |
| 729 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
| 730 "RegisterRxVadObserver()"); | |
| 731 if (!_shared->statistics().Initialized()) { | |
| 732 _shared->SetLastError(VE_NOT_INITED, kTraceError); | |
| 733 return -1; | |
| 734 } | |
| 735 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | |
| 736 voe::Channel* channelPtr = ch.channel(); | |
| 737 if (channelPtr == NULL) { | |
| 738 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | |
| 739 "RegisterRxVadObserver() failed to locate channel"); | |
| 740 return -1; | |
| 741 } | |
| 742 return channelPtr->RegisterRxVadObserver(observer); | |
| 743 } | |
| 744 | |
| 745 int VoEAudioProcessingImpl::DeRegisterRxVadObserver(int channel) { | |
| 746 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
| 747 "DeRegisterRxVadObserver()"); | |
| 748 if (!_shared->statistics().Initialized()) { | |
| 749 _shared->SetLastError(VE_NOT_INITED, kTraceError); | |
| 750 return -1; | |
| 751 } | |
| 752 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | |
| 753 voe::Channel* channelPtr = ch.channel(); | |
| 754 if (channelPtr == NULL) { | |
| 755 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | |
| 756 "DeRegisterRxVadObserver() failed to locate channel"); | |
| 757 return -1; | |
| 758 } | |
| 759 | |
| 760 return channelPtr->DeRegisterRxVadObserver(); | |
| 761 } | |
| 762 | |
| 763 int VoEAudioProcessingImpl::VoiceActivityIndicator(int channel) { | 582 int VoEAudioProcessingImpl::VoiceActivityIndicator(int channel) { |
| 764 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 583 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 765 "VoiceActivityIndicator(channel=%d)", channel); | 584 "VoiceActivityIndicator(channel=%d)", channel); |
| 766 if (!_shared->statistics().Initialized()) { | 585 if (!_shared->statistics().Initialized()) { |
| 767 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 586 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
| 768 return -1; | 587 return -1; |
| 769 } | 588 } |
| 770 | 589 |
| 771 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 590 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 772 voe::Channel* channelPtr = ch.channel(); | 591 voe::Channel* channelPtr = ch.channel(); |
| 773 if (channelPtr == NULL) { | 592 if (channelPtr == NULL) { |
| 774 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 593 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 775 "DeRegisterRxVadObserver() failed to locate channel"); | 594 "VoiceActivityIndicator() failed to locate channel"); |
| 776 return -1; | 595 return -1; |
| 777 } | 596 } |
| 778 int activity(-1); | 597 int activity(-1); |
| 779 channelPtr->VoiceActivityIndicator(activity); | 598 channelPtr->VoiceActivityIndicator(activity); |
| 780 | 599 |
| 781 return activity; | 600 return activity; |
| 782 } | 601 } |
| 783 | 602 |
| 784 int VoEAudioProcessingImpl::SetEcMetricsStatus(bool enable) { | 603 int VoEAudioProcessingImpl::SetEcMetricsStatus(bool enable) { |
| 785 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 604 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 _shared->transmit_mixer()->EnableStereoChannelSwapping(enable); | 856 _shared->transmit_mixer()->EnableStereoChannelSwapping(enable); |
| 1038 } | 857 } |
| 1039 | 858 |
| 1040 bool VoEAudioProcessingImpl::IsStereoChannelSwappingEnabled() { | 859 bool VoEAudioProcessingImpl::IsStereoChannelSwappingEnabled() { |
| 1041 return _shared->transmit_mixer()->IsStereoChannelSwappingEnabled(); | 860 return _shared->transmit_mixer()->IsStereoChannelSwappingEnabled(); |
| 1042 } | 861 } |
| 1043 | 862 |
| 1044 #endif // #ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API | 863 #endif // #ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API |
| 1045 | 864 |
| 1046 } // namespace webrtc | 865 } // namespace webrtc |
| OLD | NEW |