xref: /aosp_15_r20/external/webrtc/modules/audio_processing/aec3/config_selector.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2022 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 #ifndef MODULES_AUDIO_PROCESSING_AEC3_CONFIG_SELECTOR_H_
12 #define MODULES_AUDIO_PROCESSING_AEC3_CONFIG_SELECTOR_H_
13 
14 #include "absl/types/optional.h"
15 #include "api/audio/echo_canceller3_config.h"
16 
17 namespace webrtc {
18 
19 // Selects the config to use.
20 class ConfigSelector {
21  public:
22   ConfigSelector(
23       const EchoCanceller3Config& config,
24       const absl::optional<EchoCanceller3Config>& multichannel_config,
25       int num_render_input_channels);
26 
27   // Updates the config selection based on the detection of multichannel
28   // content.
29   void Update(bool multichannel_content);
30 
active_config()31   const EchoCanceller3Config& active_config() const { return *active_config_; }
32 
33  private:
34   const EchoCanceller3Config config_;
35   const absl::optional<EchoCanceller3Config> multichannel_config_;
36   const EchoCanceller3Config* active_config_ = nullptr;
37 };
38 
39 }  // namespace webrtc
40 
41 #endif  // MODULES_AUDIO_PROCESSING_AEC3_CONFIG_SELECTOR_H_
42