| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 webrtc::EcModes ec_mode = webrtc::kEcConference; | 594 webrtc::EcModes ec_mode = webrtc::kEcConference; |
| 595 webrtc::AecmModes aecm_mode = webrtc::kAecmSpeakerphone; | 595 webrtc::AecmModes aecm_mode = webrtc::kAecmSpeakerphone; |
| 596 webrtc::AgcModes agc_mode = webrtc::kAgcAdaptiveAnalog; | 596 webrtc::AgcModes agc_mode = webrtc::kAgcAdaptiveAnalog; |
| 597 webrtc::NsModes ns_mode = webrtc::kNsHighSuppression; | 597 webrtc::NsModes ns_mode = webrtc::kNsHighSuppression; |
| 598 if (options.aecm_generate_comfort_noise) { | 598 if (options.aecm_generate_comfort_noise) { |
| 599 LOG(LS_VERBOSE) << "Comfort noise explicitly set to " | 599 LOG(LS_VERBOSE) << "Comfort noise explicitly set to " |
| 600 << *options.aecm_generate_comfort_noise | 600 << *options.aecm_generate_comfort_noise |
| 601 << " (default is false)."; | 601 << " (default is false)."; |
| 602 } | 602 } |
| 603 | 603 |
| 604 #if defined(IOS) | 604 #if defined(WEBRTC_IOS) |
| 605 // On iOS, VPIO provides built-in EC and AGC. | 605 // On iOS, VPIO provides built-in EC and AGC. |
| 606 options.echo_cancellation = rtc::Optional<bool>(false); | 606 options.echo_cancellation = rtc::Optional<bool>(false); |
| 607 options.auto_gain_control = rtc::Optional<bool>(false); | 607 options.auto_gain_control = rtc::Optional<bool>(false); |
| 608 LOG(LS_INFO) << "Always disable AEC and AGC on iOS. Use built-in instead."; | 608 LOG(LS_INFO) << "Always disable AEC and AGC on iOS. Use built-in instead."; |
| 609 #elif defined(ANDROID) | 609 #elif defined(ANDROID) |
| 610 ec_mode = webrtc::kEcAecm; | 610 ec_mode = webrtc::kEcAecm; |
| 611 #endif | 611 #endif |
| 612 | 612 |
| 613 #if defined(IOS) || defined(ANDROID) | 613 #if defined(WEBRTC_IOS) || defined(ANDROID) |
| 614 // Set the AGC mode for iOS as well despite disabling it above, to avoid | 614 // Set the AGC mode for iOS as well despite disabling it above, to avoid |
| 615 // unsupported configuration errors from webrtc. | 615 // unsupported configuration errors from webrtc. |
| 616 agc_mode = webrtc::kAgcFixedDigital; | 616 agc_mode = webrtc::kAgcFixedDigital; |
| 617 options.typing_detection = rtc::Optional<bool>(false); | 617 options.typing_detection = rtc::Optional<bool>(false); |
| 618 options.experimental_agc = rtc::Optional<bool>(false); | 618 options.experimental_agc = rtc::Optional<bool>(false); |
| 619 options.extended_filter_aec = rtc::Optional<bool>(false); | 619 options.extended_filter_aec = rtc::Optional<bool>(false); |
| 620 options.experimental_ns = rtc::Optional<bool>(false); | 620 options.experimental_ns = rtc::Optional<bool>(false); |
| 621 #endif | 621 #endif |
| 622 | 622 |
| 623 // Delay Agnostic AEC automatically turns on EC if not set except on iOS | 623 // Delay Agnostic AEC automatically turns on EC if not set except on iOS |
| 624 // where the feature is not supported. | 624 // where the feature is not supported. |
| 625 bool use_delay_agnostic_aec = false; | 625 bool use_delay_agnostic_aec = false; |
| 626 #if !defined(IOS) | 626 #if !defined(WEBRTC_IOS) |
| 627 if (options.delay_agnostic_aec) { | 627 if (options.delay_agnostic_aec) { |
| 628 use_delay_agnostic_aec = *options.delay_agnostic_aec; | 628 use_delay_agnostic_aec = *options.delay_agnostic_aec; |
| 629 if (use_delay_agnostic_aec) { | 629 if (use_delay_agnostic_aec) { |
| 630 options.echo_cancellation = rtc::Optional<bool>(true); | 630 options.echo_cancellation = rtc::Optional<bool>(true); |
| 631 options.extended_filter_aec = rtc::Optional<bool>(true); | 631 options.extended_filter_aec = rtc::Optional<bool>(true); |
| 632 ec_mode = webrtc::kEcConference; | 632 ec_mode = webrtc::kEcConference; |
| 633 } | 633 } |
| 634 } | 634 } |
| 635 #endif | 635 #endif |
| 636 | 636 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 *options.playout_sample_rate)) { | 854 *options.playout_sample_rate)) { |
| 855 LOG_RTCERR1(SetPlayoutSampleRate, *options.playout_sample_rate); | 855 LOG_RTCERR1(SetPlayoutSampleRate, *options.playout_sample_rate); |
| 856 } | 856 } |
| 857 } | 857 } |
| 858 | 858 |
| 859 return true; | 859 return true; |
| 860 } | 860 } |
| 861 | 861 |
| 862 void WebRtcVoiceEngine::SetDefaultDevices() { | 862 void WebRtcVoiceEngine::SetDefaultDevices() { |
| 863 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 863 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 864 #if !defined(IOS) | 864 #if !defined(WEBRTC_IOS) |
| 865 int in_id = kDefaultAudioDeviceId; | 865 int in_id = kDefaultAudioDeviceId; |
| 866 int out_id = kDefaultAudioDeviceId; | 866 int out_id = kDefaultAudioDeviceId; |
| 867 LOG(LS_INFO) << "Setting microphone to (id=" << in_id | 867 LOG(LS_INFO) << "Setting microphone to (id=" << in_id |
| 868 << ") and speaker to (id=" << out_id << ")"; | 868 << ") and speaker to (id=" << out_id << ")"; |
| 869 | 869 |
| 870 bool ret = true; | 870 bool ret = true; |
| 871 if (voe_wrapper_->hw()->SetRecordingDevice(in_id) == -1) { | 871 if (voe_wrapper_->hw()->SetRecordingDevice(in_id) == -1) { |
| 872 LOG_RTCERR1(SetRecordingDevice, in_id); | 872 LOG_RTCERR1(SetRecordingDevice, in_id); |
| 873 ret = false; | 873 ret = false; |
| 874 } | 874 } |
| 875 webrtc::AudioProcessing* ap = voe()->base()->audio_processing(); | 875 webrtc::AudioProcessing* ap = voe()->base()->audio_processing(); |
| 876 if (ap) { | 876 if (ap) { |
| 877 ap->Initialize(); | 877 ap->Initialize(); |
| 878 } | 878 } |
| 879 | 879 |
| 880 if (voe_wrapper_->hw()->SetPlayoutDevice(out_id) == -1) { | 880 if (voe_wrapper_->hw()->SetPlayoutDevice(out_id) == -1) { |
| 881 LOG_RTCERR1(SetPlayoutDevice, out_id); | 881 LOG_RTCERR1(SetPlayoutDevice, out_id); |
| 882 ret = false; | 882 ret = false; |
| 883 } | 883 } |
| 884 | 884 |
| 885 if (ret) { | 885 if (ret) { |
| 886 LOG(LS_INFO) << "Set microphone to (id=" << in_id | 886 LOG(LS_INFO) << "Set microphone to (id=" << in_id |
| 887 << ") and speaker to (id=" << out_id << ")"; | 887 << ") and speaker to (id=" << out_id << ")"; |
| 888 } | 888 } |
| 889 #endif // !IOS | 889 #endif // !WEBRTC_IOS |
| 890 } | 890 } |
| 891 | 891 |
| 892 bool WebRtcVoiceEngine::GetOutputVolume(int* level) { | 892 bool WebRtcVoiceEngine::GetOutputVolume(int* level) { |
| 893 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 893 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 894 unsigned int ulevel; | 894 unsigned int ulevel; |
| 895 if (voe_wrapper_->volume()->GetSpeakerVolume(ulevel) == -1) { | 895 if (voe_wrapper_->volume()->GetSpeakerVolume(ulevel) == -1) { |
| 896 LOG_RTCERR1(GetSpeakerVolume, level); | 896 LOG_RTCERR1(GetSpeakerVolume, level); |
| 897 return false; | 897 return false; |
| 898 } | 898 } |
| 899 *level = ulevel; | 899 *level = ulevel; |
| (...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2509 } | 2509 } |
| 2510 } else { | 2510 } else { |
| 2511 LOG(LS_INFO) << "Stopping playout for channel #" << channel; | 2511 LOG(LS_INFO) << "Stopping playout for channel #" << channel; |
| 2512 engine()->voe()->base()->StopPlayout(channel); | 2512 engine()->voe()->base()->StopPlayout(channel); |
| 2513 } | 2513 } |
| 2514 return true; | 2514 return true; |
| 2515 } | 2515 } |
| 2516 } // namespace cricket | 2516 } // namespace cricket |
| 2517 | 2517 |
| 2518 #endif // HAVE_WEBRTC_VOICE | 2518 #endif // HAVE_WEBRTC_VOICE |
| OLD | NEW |