Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 553 options.stereo_swapping = rtc::Optional<bool>(false); | 553 options.stereo_swapping = rtc::Optional<bool>(false); |
| 554 options.audio_jitter_buffer_max_packets = rtc::Optional<int>(50); | 554 options.audio_jitter_buffer_max_packets = rtc::Optional<int>(50); |
| 555 options.audio_jitter_buffer_fast_accelerate = rtc::Optional<bool>(false); | 555 options.audio_jitter_buffer_fast_accelerate = rtc::Optional<bool>(false); |
| 556 options.typing_detection = rtc::Optional<bool>(true); | 556 options.typing_detection = rtc::Optional<bool>(true); |
| 557 options.adjust_agc_delta = rtc::Optional<int>(0); | 557 options.adjust_agc_delta = rtc::Optional<int>(0); |
| 558 options.experimental_agc = rtc::Optional<bool>(false); | 558 options.experimental_agc = rtc::Optional<bool>(false); |
| 559 options.extended_filter_aec = rtc::Optional<bool>(false); | 559 options.extended_filter_aec = rtc::Optional<bool>(false); |
| 560 options.delay_agnostic_aec = rtc::Optional<bool>(false); | 560 options.delay_agnostic_aec = rtc::Optional<bool>(false); |
| 561 options.experimental_ns = rtc::Optional<bool>(false); | 561 options.experimental_ns = rtc::Optional<bool>(false); |
| 562 options.intelligibility_enhancer = rtc::Optional<bool>(false); | 562 options.intelligibility_enhancer = rtc::Optional<bool>(false); |
| 563 options.level_control = rtc::Optional<bool>(false); | |
| 563 bool error = ApplyOptions(options); | 564 bool error = ApplyOptions(options); |
| 564 RTC_DCHECK(error); | 565 RTC_DCHECK(error); |
| 565 } | 566 } |
| 566 | 567 |
| 567 SetDefaultDevices(); | 568 SetDefaultDevices(); |
| 568 } | 569 } |
| 569 | 570 |
| 570 WebRtcVoiceEngine::~WebRtcVoiceEngine() { | 571 WebRtcVoiceEngine::~WebRtcVoiceEngine() { |
| 571 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 572 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 572 LOG(LS_INFO) << "WebRtcVoiceEngine::~WebRtcVoiceEngine"; | 573 LOG(LS_INFO) << "WebRtcVoiceEngine::~WebRtcVoiceEngine"; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 676 #endif | 677 #endif |
| 677 if (ec_mode == webrtc::kEcAecm) { | 678 if (ec_mode == webrtc::kEcAecm) { |
| 678 bool cn = options.aecm_generate_comfort_noise.value_or(false); | 679 bool cn = options.aecm_generate_comfort_noise.value_or(false); |
| 679 if (voep->SetAecmMode(aecm_mode, cn) != 0) { | 680 if (voep->SetAecmMode(aecm_mode, cn) != 0) { |
| 680 LOG_RTCERR2(SetAecmMode, aecm_mode, cn); | 681 LOG_RTCERR2(SetAecmMode, aecm_mode, cn); |
| 681 return false; | 682 return false; |
| 682 } | 683 } |
| 683 } | 684 } |
| 684 } | 685 } |
| 685 | 686 |
| 687 // Use optional to avoid uneccessary calls to BuiltInAGCIsAvailable while | |
| 688 // complying with the unittest requirements of only 1 call per test. | |
| 689 rtc::Optional<bool> built_in_agc_avaliable; | |
| 690 if (options.level_control) { | |
| 691 if (!built_in_agc_avaliable) { | |
| 692 built_in_agc_avaliable = | |
| 693 rtc::Optional<bool>(adm()->BuiltInAGCIsAvailable()); | |
| 694 } | |
| 695 if (*built_in_agc_avaliable) { | |
| 696 // Disable internal software level control if built-in AGC is enabled, | |
| 697 // i.e., replace the software AGC with the built-in AGC. | |
| 698 options.level_control = rtc::Optional<bool>(false); | |
| 699 } | |
| 700 } | |
| 701 | |
| 686 if (options.auto_gain_control) { | 702 if (options.auto_gain_control) { |
| 687 const bool built_in_agc = adm()->BuiltInAGCIsAvailable(); | 703 if (!built_in_agc_avaliable) { |
| 688 if (built_in_agc) { | 704 built_in_agc_avaliable = |
| 705 rtc::Optional<bool>(adm()->BuiltInAGCIsAvailable()); | |
| 706 } | |
| 707 if (*built_in_agc_avaliable) { | |
| 689 if (adm()->EnableBuiltInAGC(*options.auto_gain_control) == 0 && | 708 if (adm()->EnableBuiltInAGC(*options.auto_gain_control) == 0 && |
| 690 *options.auto_gain_control) { | 709 *options.auto_gain_control) { |
| 691 // Disable internal software AGC if built-in AGC is enabled, | 710 // Disable internal software AGC if built-in AGC is enabled, |
| 692 // i.e., replace the software AGC with the built-in AGC. | 711 // i.e., replace the software AGC with the built-in AGC. |
| 693 options.auto_gain_control = rtc::Optional<bool>(false); | 712 options.auto_gain_control = rtc::Optional<bool>(false); |
| 694 LOG(LS_INFO) << "Disabling AGC since built-in AGC will be used instead"; | 713 LOG(LS_INFO) << "Disabling AGC since built-in AGC will be used instead"; |
| 695 } | 714 } |
| 696 } | 715 } |
| 697 if (voep->SetAgcStatus(*options.auto_gain_control, agc_mode) == -1) { | 716 if (voep->SetAgcStatus(*options.auto_gain_control, agc_mode) == -1) { |
| 698 LOG_RTCERR2(SetAgcStatus, *options.auto_gain_control, agc_mode); | 717 LOG_RTCERR2(SetAgcStatus, *options.auto_gain_control, agc_mode); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 835 new webrtc::ExperimentalNs(*experimental_ns_)); | 854 new webrtc::ExperimentalNs(*experimental_ns_)); |
| 836 } | 855 } |
| 837 | 856 |
| 838 if (intelligibility_enhancer_) { | 857 if (intelligibility_enhancer_) { |
| 839 LOG(LS_INFO) << "Intelligibility Enhancer is enabled? " | 858 LOG(LS_INFO) << "Intelligibility Enhancer is enabled? " |
| 840 << *intelligibility_enhancer_; | 859 << *intelligibility_enhancer_; |
| 841 config.Set<webrtc::Intelligibility>( | 860 config.Set<webrtc::Intelligibility>( |
| 842 new webrtc::Intelligibility(*intelligibility_enhancer_)); | 861 new webrtc::Intelligibility(*intelligibility_enhancer_)); |
| 843 } | 862 } |
| 844 | 863 |
| 864 if (options.level_control) { | |
| 865 level_control_ = options.level_control; | |
| 866 } | |
| 867 | |
| 868 if (level_control_) { | |
| 869 LOG(LS_INFO) << "Level Control is enabled? " << *level_control_; | |
|
tommi
2016/06/27 07:19:41
Should this be:
"Level control enabled, value=" <<
peah-webrtc
2016/06/27 08:22:12
That makes sense! I wrote it in this way to be con
| |
| 870 config.Set<webrtc::LevelControl>(new webrtc::LevelControl(*level_control_)); | |
| 871 } | |
| 872 | |
| 845 // We check audioproc for the benefit of tests, since FakeWebRtcVoiceEngine | 873 // We check audioproc for the benefit of tests, since FakeWebRtcVoiceEngine |
| 846 // returns NULL on audio_processing(). | 874 // returns NULL on audio_processing(). |
| 847 webrtc::AudioProcessing* audioproc = voe_wrapper_->base()->audio_processing(); | 875 webrtc::AudioProcessing* audioproc = voe_wrapper_->base()->audio_processing(); |
| 848 if (audioproc) { | 876 if (audioproc) { |
| 849 audioproc->SetExtraOptions(config); | 877 audioproc->SetExtraOptions(config); |
| 850 } | 878 } |
| 851 | 879 |
| 852 if (options.recording_sample_rate) { | 880 if (options.recording_sample_rate) { |
| 853 LOG(LS_INFO) << "Recording sample rate is " | 881 LOG(LS_INFO) << "Recording sample rate is " |
| 854 << *options.recording_sample_rate; | 882 << *options.recording_sample_rate; |
| (...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2607 } | 2635 } |
| 2608 } else { | 2636 } else { |
| 2609 LOG(LS_INFO) << "Stopping playout for channel #" << channel; | 2637 LOG(LS_INFO) << "Stopping playout for channel #" << channel; |
| 2610 engine()->voe()->base()->StopPlayout(channel); | 2638 engine()->voe()->base()->StopPlayout(channel); |
| 2611 } | 2639 } |
| 2612 return true; | 2640 return true; |
| 2613 } | 2641 } |
| 2614 } // namespace cricket | 2642 } // namespace cricket |
| 2615 | 2643 |
| 2616 #endif // HAVE_WEBRTC_VOICE | 2644 #endif // HAVE_WEBRTC_VOICE |
| OLD | NEW |