Sam Zackrisson | 74ed734 | 2018-08-16 10:54:07 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #include "modules/audio_processing/echo_control_mobile_proxy.h" |
| 12 | |
Sam Zackrisson | 2fbb83b | 2018-09-28 12:40:47 +0200 | [diff] [blame] | 13 | #include "rtc_base/logging.h" |
| 14 | |
Sam Zackrisson | 74ed734 | 2018-08-16 10:54:07 +0200 | [diff] [blame] | 15 | namespace webrtc { |
| 16 | |
| 17 | EchoControlMobileProxy::EchoControlMobileProxy( |
| 18 | AudioProcessing* audio_processing, |
Sam Zackrisson | 2fbb83b | 2018-09-28 12:40:47 +0200 | [diff] [blame] | 19 | EchoControlMobileImpl* echo_control_mobile) |
Sam Zackrisson | 74ed734 | 2018-08-16 10:54:07 +0200 | [diff] [blame] | 20 | : audio_processing_(audio_processing), |
| 21 | echo_control_mobile_(echo_control_mobile) {} |
| 22 | |
| 23 | EchoControlMobileProxy::~EchoControlMobileProxy() = default; |
| 24 | |
| 25 | int EchoControlMobileProxy::Enable(bool enable) { |
Sam Zackrisson | 74ed734 | 2018-08-16 10:54:07 +0200 | [diff] [blame] | 26 | AudioProcessing::Config apm_config = audio_processing_->GetConfig(); |
| 27 | bool aecm_enabled = apm_config.echo_canceller.enabled && |
| 28 | apm_config.echo_canceller.mobile_mode; |
| 29 | if ((aecm_enabled && !enable) || (!aecm_enabled && enable)) { |
| 30 | apm_config.echo_canceller.enabled = enable; |
| 31 | apm_config.echo_canceller.mobile_mode = true; |
| 32 | audio_processing_->ApplyConfig(apm_config); |
| 33 | } |
Sam Zackrisson | 74ed734 | 2018-08-16 10:54:07 +0200 | [diff] [blame] | 34 | return AudioProcessing::kNoError; |
| 35 | } |
| 36 | |
| 37 | bool EchoControlMobileProxy::is_enabled() const { |
| 38 | return echo_control_mobile_->is_enabled(); |
| 39 | } |
| 40 | |
| 41 | int EchoControlMobileProxy::set_routing_mode(RoutingMode mode) { |
Sam Zackrisson | 2fbb83b | 2018-09-28 12:40:47 +0200 | [diff] [blame] | 42 | RTC_LOG(LS_ERROR) << "Ignoring deprecated setting: AECM routing mode"; |
| 43 | return AudioProcessing::kUnsupportedFunctionError; |
Sam Zackrisson | 74ed734 | 2018-08-16 10:54:07 +0200 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | EchoControlMobile::RoutingMode EchoControlMobileProxy::routing_mode() const { |
Sam Zackrisson | 2fbb83b | 2018-09-28 12:40:47 +0200 | [diff] [blame] | 47 | return EchoControlMobile::kSpeakerphone; |
Sam Zackrisson | 74ed734 | 2018-08-16 10:54:07 +0200 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | int EchoControlMobileProxy::enable_comfort_noise(bool enable) { |
Sam Zackrisson | 2fbb83b | 2018-09-28 12:40:47 +0200 | [diff] [blame] | 51 | RTC_LOG(LS_ERROR) << "Ignoring deprecated setting: AECM comfort noise"; |
| 52 | return AudioProcessing::kUnsupportedFunctionError; |
Sam Zackrisson | 74ed734 | 2018-08-16 10:54:07 +0200 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | bool EchoControlMobileProxy::is_comfort_noise_enabled() const { |
Sam Zackrisson | 2fbb83b | 2018-09-28 12:40:47 +0200 | [diff] [blame] | 56 | return false; |
Sam Zackrisson | 74ed734 | 2018-08-16 10:54:07 +0200 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | int EchoControlMobileProxy::SetEchoPath(const void* echo_path, |
| 60 | size_t size_bytes) { |
Sam Zackrisson | 2fbb83b | 2018-09-28 12:40:47 +0200 | [diff] [blame] | 61 | return AudioProcessing::kUnsupportedFunctionError; |
Sam Zackrisson | 74ed734 | 2018-08-16 10:54:07 +0200 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | int EchoControlMobileProxy::GetEchoPath(void* echo_path, |
| 65 | size_t size_bytes) const { |
Sam Zackrisson | 2fbb83b | 2018-09-28 12:40:47 +0200 | [diff] [blame] | 66 | return AudioProcessing::kUnsupportedFunctionError; |
Sam Zackrisson | 74ed734 | 2018-08-16 10:54:07 +0200 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | } // namespace webrtc |