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 "modules/audio_processing/include/audio_processing.h"
12 
13 #include <memory>
14 
15 #include "modules/audio_processing/audio_processing_impl.h"
16 #include "rtc_base/ref_counted_object.h"
17 
18 namespace webrtc {
19 
20 AudioProcessingBuilder::AudioProcessingBuilder() = default;
21 AudioProcessingBuilder::~AudioProcessingBuilder() = default;
22 
Create()23 AudioProcessing* AudioProcessingBuilder::Create() {
24   webrtc::Config config;
25   return Create(config);
26 }
27 
Create(const webrtc::Config & config)28 AudioProcessing* AudioProcessingBuilder::Create(const webrtc::Config& config) {
29 #ifdef WEBRTC_EXCLUDE_AUDIO_PROCESSING_MODULE
30 
31   // Implementation returning a null pointer for using when the APM is excluded
32   // from the build..
33   return nullptr;
34 
35 #else
36 
37   // Standard implementation.
38   return new rtc::RefCountedObject<AudioProcessingImpl>(
39       config, std::move(capture_post_processing_),
40       std::move(render_pre_processing_), std::move(echo_control_factory_),
41       std::move(echo_detector_), std::move(capture_analyzer_));
42 #endif
43 }
44 
45 }  // namespace webrtc
46