Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: talk/media/webrtc/webrtcvoiceengine.cc

Issue 1254883002: Refactor the AudioDevice for iOS and improve the performance and stability (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased and cleaned up Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/modules/audio_device/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 bool aecm_comfort_noise = false; 638 bool aecm_comfort_noise = false;
639 if (options.aecm_generate_comfort_noise.Get(&aecm_comfort_noise)) { 639 if (options.aecm_generate_comfort_noise.Get(&aecm_comfort_noise)) {
640 LOG(LS_VERBOSE) << "Comfort noise explicitly set to " 640 LOG(LS_VERBOSE) << "Comfort noise explicitly set to "
641 << aecm_comfort_noise << " (default is false)."; 641 << aecm_comfort_noise << " (default is false).";
642 } 642 }
643 643
644 #if defined(IOS) 644 #if defined(IOS)
645 // On iOS, VPIO provides built-in EC and AGC. 645 // On iOS, VPIO provides built-in EC and AGC.
646 options.echo_cancellation.Set(false); 646 options.echo_cancellation.Set(false);
647 options.auto_gain_control.Set(false); 647 options.auto_gain_control.Set(false);
648 LOG(LS_INFO) << "Always disable AEC and AGC on iOS. Use built-in instead.";
648 #elif defined(ANDROID) 649 #elif defined(ANDROID)
649 ec_mode = webrtc::kEcAecm; 650 ec_mode = webrtc::kEcAecm;
650 #endif 651 #endif
651 652
652 #if defined(IOS) || defined(ANDROID) 653 #if defined(IOS) || defined(ANDROID)
653 // Set the AGC mode for iOS as well despite disabling it above, to avoid 654 // Set the AGC mode for iOS as well despite disabling it above, to avoid
654 // unsupported configuration errors from webrtc. 655 // unsupported configuration errors from webrtc.
655 agc_mode = webrtc::kAgcFixedDigital; 656 agc_mode = webrtc::kAgcFixedDigital;
656 options.typing_detection.Set(false); 657 options.typing_detection.Set(false);
657 options.experimental_agc.Set(false); 658 options.experimental_agc.Set(false);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 // i.e., replace the software EC with the built-in EC. 696 // i.e., replace the software EC with the built-in EC.
696 options.echo_cancellation.Set(false); 697 options.echo_cancellation.Set(false);
697 echo_cancellation = false; 698 echo_cancellation = false;
698 LOG(LS_INFO) << "Disabling EC since built-in EC will be used instead"; 699 LOG(LS_INFO) << "Disabling EC since built-in EC will be used instead";
699 } 700 }
700 } 701 }
701 if (voep->SetEcStatus(echo_cancellation, ec_mode) == -1) { 702 if (voep->SetEcStatus(echo_cancellation, ec_mode) == -1) {
702 LOG_RTCERR2(SetEcStatus, echo_cancellation, ec_mode); 703 LOG_RTCERR2(SetEcStatus, echo_cancellation, ec_mode);
703 return false; 704 return false;
704 } else { 705 } else {
705 LOG(LS_VERBOSE) << "Echo control set to " << echo_cancellation 706 LOG(LS_INFO) << "Echo control set to " << echo_cancellation
706 << " with mode " << ec_mode; 707 << " with mode " << ec_mode;
707 } 708 }
708 #if !defined(ANDROID) 709 #if !defined(ANDROID)
709 // TODO(ajm): Remove the error return on Android from webrtc. 710 // TODO(ajm): Remove the error return on Android from webrtc.
710 if (voep->SetEcMetricsStatus(echo_cancellation) == -1) { 711 if (voep->SetEcMetricsStatus(echo_cancellation) == -1) {
711 LOG_RTCERR1(SetEcMetricsStatus, echo_cancellation); 712 LOG_RTCERR1(SetEcMetricsStatus, echo_cancellation);
712 return false; 713 return false;
713 } 714 }
714 #endif 715 #endif
715 if (ec_mode == webrtc::kEcAecm) { 716 if (ec_mode == webrtc::kEcAecm) {
716 if (voep->SetAecmMode(aecm_mode, aecm_comfort_noise) != 0) { 717 if (voep->SetAecmMode(aecm_mode, aecm_comfort_noise) != 0) {
717 LOG_RTCERR2(SetAecmMode, aecm_mode, aecm_comfort_noise); 718 LOG_RTCERR2(SetAecmMode, aecm_mode, aecm_comfort_noise);
718 return false; 719 return false;
719 } 720 }
720 } 721 }
721 } 722 }
722 723
723 bool auto_gain_control; 724 bool auto_gain_control;
724 if (options.auto_gain_control.Get(&auto_gain_control)) { 725 if (options.auto_gain_control.Get(&auto_gain_control)) {
725 if (voep->SetAgcStatus(auto_gain_control, agc_mode) == -1) { 726 if (voep->SetAgcStatus(auto_gain_control, agc_mode) == -1) {
726 LOG_RTCERR2(SetAgcStatus, auto_gain_control, agc_mode); 727 LOG_RTCERR2(SetAgcStatus, auto_gain_control, agc_mode);
727 return false; 728 return false;
728 } else { 729 } else {
729 LOG(LS_VERBOSE) << "Auto gain set to " << auto_gain_control 730 LOG(LS_INFO) << "Auto gain set to " << auto_gain_control << " with mode "
730 << " with mode " << agc_mode; 731 << agc_mode;
731 } 732 }
732 } 733 }
733 734
734 if (options.tx_agc_target_dbov.IsSet() || 735 if (options.tx_agc_target_dbov.IsSet() ||
735 options.tx_agc_digital_compression_gain.IsSet() || 736 options.tx_agc_digital_compression_gain.IsSet() ||
736 options.tx_agc_limiter.IsSet()) { 737 options.tx_agc_limiter.IsSet()) {
737 // Override default_agc_config_. Generally, an unset option means "leave 738 // Override default_agc_config_. Generally, an unset option means "leave
738 // the VoE bits alone" in this function, so we want whatever is set to be 739 // the VoE bits alone" in this function, so we want whatever is set to be
739 // stored as the new "default". If we didn't, then setting e.g. 740 // stored as the new "default". If we didn't, then setting e.g.
740 // tx_agc_target_dbov would reset digital compression gain and limiter 741 // tx_agc_target_dbov would reset digital compression gain and limiter
(...skipping 2906 matching lines...) Expand 10 before | Expand all | Expand 10 after
3647 3648
3648 int WebRtcSoundclipStream::Rewind() { 3649 int WebRtcSoundclipStream::Rewind() {
3649 mem_.Rewind(); 3650 mem_.Rewind();
3650 // Return -1 to keep VoiceEngine from looping. 3651 // Return -1 to keep VoiceEngine from looping.
3651 return (loop_) ? 0 : -1; 3652 return (loop_) ? 0 : -1;
3652 } 3653 }
3653 3654
3654 } // namespace cricket 3655 } // namespace cricket
3655 3656
3656 #endif // HAVE_WEBRTC_VOICE 3657 #endif // HAVE_WEBRTC_VOICE
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_device/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698