xref: /aosp_15_r20/external/webrtc/modules/audio_processing/audio_processing_builder_impl.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2020 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 <memory>
12 
13 #include "api/make_ref_counted.h"
14 #include "modules/audio_processing/audio_processing_impl.h"
15 #include "modules/audio_processing/include/audio_processing.h"
16 
17 namespace webrtc {
18 
19 AudioProcessingBuilder::AudioProcessingBuilder() = default;
20 AudioProcessingBuilder::~AudioProcessingBuilder() = default;
21 
Create()22 rtc::scoped_refptr<AudioProcessing> AudioProcessingBuilder::Create() {
23 #ifdef WEBRTC_EXCLUDE_AUDIO_PROCESSING_MODULE
24   // Return a null pointer when the APM is excluded from the build.
25   return nullptr;
26 #else  // WEBRTC_EXCLUDE_AUDIO_PROCESSING_MODULE
27   return rtc::make_ref_counted<AudioProcessingImpl>(
28       config_, std::move(capture_post_processing_),
29       std::move(render_pre_processing_), std::move(echo_control_factory_),
30       std::move(echo_detector_), std::move(capture_analyzer_));
31 #endif
32 }
33 
34 }  // namespace webrtc
35