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

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

Issue 2240763002: Removed the deactivation of the level controller when there is a built-in AGC available (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 4 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 | no next file » | 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 * 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 #endif 676 #endif
677 if (ec_mode == webrtc::kEcAecm) { 677 if (ec_mode == webrtc::kEcAecm) {
678 bool cn = options.aecm_generate_comfort_noise.value_or(false); 678 bool cn = options.aecm_generate_comfort_noise.value_or(false);
679 if (voep->SetAecmMode(aecm_mode, cn) != 0) { 679 if (voep->SetAecmMode(aecm_mode, cn) != 0) {
680 LOG_RTCERR2(SetAecmMode, aecm_mode, cn); 680 LOG_RTCERR2(SetAecmMode, aecm_mode, cn);
681 return false; 681 return false;
682 } 682 }
683 } 683 }
684 } 684 }
685 685
686 // Use optional to avoid uneccessary calls to BuiltInAGCIsAvailable while
687 // complying with the unittest requirements of only 1 call per test.
688 rtc::Optional<bool> built_in_agc_avaliable;
689 if (options.level_control) {
690 if (!built_in_agc_avaliable) {
691 built_in_agc_avaliable =
692 rtc::Optional<bool>(adm()->BuiltInAGCIsAvailable());
693 }
694 RTC_DCHECK(built_in_agc_avaliable);
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
702 if (options.auto_gain_control) { 686 if (options.auto_gain_control) {
703 if (!built_in_agc_avaliable) { 687 bool built_in_agc_avaliable = adm()->BuiltInAGCIsAvailable();
704 built_in_agc_avaliable = 688 if (built_in_agc_avaliable) {
705 rtc::Optional<bool>(adm()->BuiltInAGCIsAvailable());
706 }
707 RTC_DCHECK(built_in_agc_avaliable);
708 if (*built_in_agc_avaliable) {
709 if (adm()->EnableBuiltInAGC(*options.auto_gain_control) == 0 && 689 if (adm()->EnableBuiltInAGC(*options.auto_gain_control) == 0 &&
710 *options.auto_gain_control) { 690 *options.auto_gain_control) {
711 // Disable internal software AGC if built-in AGC is enabled, 691 // Disable internal software AGC if built-in AGC is enabled,
712 // i.e., replace the software AGC with the built-in AGC. 692 // i.e., replace the software AGC with the built-in AGC.
713 options.auto_gain_control = rtc::Optional<bool>(false); 693 options.auto_gain_control = rtc::Optional<bool>(false);
714 LOG(LS_INFO) << "Disabling AGC since built-in AGC will be used instead"; 694 LOG(LS_INFO) << "Disabling AGC since built-in AGC will be used instead";
715 } 695 }
716 } 696 }
717 if (voep->SetAgcStatus(*options.auto_gain_control, agc_mode) == -1) { 697 if (voep->SetAgcStatus(*options.auto_gain_control, agc_mode) == -1) {
718 LOG_RTCERR2(SetAgcStatus, *options.auto_gain_control, agc_mode); 698 LOG_RTCERR2(SetAgcStatus, *options.auto_gain_control, agc_mode);
(...skipping 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after
2609 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 2589 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
2610 const auto it = send_streams_.find(ssrc); 2590 const auto it = send_streams_.find(ssrc);
2611 if (it != send_streams_.end()) { 2591 if (it != send_streams_.end()) {
2612 return it->second->channel(); 2592 return it->second->channel();
2613 } 2593 }
2614 return -1; 2594 return -1;
2615 } 2595 }
2616 } // namespace cricket 2596 } // namespace cricket
2617 2597
2618 #endif // HAVE_WEBRTC_VOICE 2598 #endif // HAVE_WEBRTC_VOICE
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698