blob: e3909db3334d95256356139975dd6a03c74d2d82 [file] [log] [blame]
Sam Zackrisson74ed7342018-08-16 10:54:07 +02001/*
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 Zackrisson2fbb83b2018-09-28 12:40:47 +020013#include "rtc_base/logging.h"
14
Sam Zackrisson74ed7342018-08-16 10:54:07 +020015namespace webrtc {
16
17EchoControlMobileProxy::EchoControlMobileProxy(
18 AudioProcessing* audio_processing,
Sam Zackrisson2fbb83b2018-09-28 12:40:47 +020019 EchoControlMobileImpl* echo_control_mobile)
Sam Zackrisson74ed7342018-08-16 10:54:07 +020020 : audio_processing_(audio_processing),
21 echo_control_mobile_(echo_control_mobile) {}
22
23EchoControlMobileProxy::~EchoControlMobileProxy() = default;
24
25int EchoControlMobileProxy::Enable(bool enable) {
Sam Zackrisson74ed7342018-08-16 10:54:07 +020026 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 Zackrisson74ed7342018-08-16 10:54:07 +020034 return AudioProcessing::kNoError;
35}
36
37bool EchoControlMobileProxy::is_enabled() const {
38 return echo_control_mobile_->is_enabled();
39}
40
41int EchoControlMobileProxy::set_routing_mode(RoutingMode mode) {
Sam Zackrisson2fbb83b2018-09-28 12:40:47 +020042 RTC_LOG(LS_ERROR) << "Ignoring deprecated setting: AECM routing mode";
43 return AudioProcessing::kUnsupportedFunctionError;
Sam Zackrisson74ed7342018-08-16 10:54:07 +020044}
45
46EchoControlMobile::RoutingMode EchoControlMobileProxy::routing_mode() const {
Sam Zackrisson2fbb83b2018-09-28 12:40:47 +020047 return EchoControlMobile::kSpeakerphone;
Sam Zackrisson74ed7342018-08-16 10:54:07 +020048}
49
50int EchoControlMobileProxy::enable_comfort_noise(bool enable) {
Sam Zackrisson2fbb83b2018-09-28 12:40:47 +020051 RTC_LOG(LS_ERROR) << "Ignoring deprecated setting: AECM comfort noise";
52 return AudioProcessing::kUnsupportedFunctionError;
Sam Zackrisson74ed7342018-08-16 10:54:07 +020053}
54
55bool EchoControlMobileProxy::is_comfort_noise_enabled() const {
Sam Zackrisson2fbb83b2018-09-28 12:40:47 +020056 return false;
Sam Zackrisson74ed7342018-08-16 10:54:07 +020057}
58
59int EchoControlMobileProxy::SetEchoPath(const void* echo_path,
60 size_t size_bytes) {
Sam Zackrisson2fbb83b2018-09-28 12:40:47 +020061 return AudioProcessing::kUnsupportedFunctionError;
Sam Zackrisson74ed7342018-08-16 10:54:07 +020062}
63
64int EchoControlMobileProxy::GetEchoPath(void* echo_path,
65 size_t size_bytes) const {
Sam Zackrisson2fbb83b2018-09-28 12:40:47 +020066 return AudioProcessing::kUnsupportedFunctionError;
Sam Zackrisson74ed7342018-08-16 10:54:07 +020067}
68
69} // namespace webrtc