blob: e89bbecc687c4551c6ac8ac4e0f6d38520bd7f76 [file] [log] [blame]
Per Ã…hgrencc73ed32020-04-26 23:56:17 +02001/*
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
18namespace webrtc {
19
20AudioProcessingBuilder::AudioProcessingBuilder() = default;
21AudioProcessingBuilder::~AudioProcessingBuilder() = default;
22
23AudioProcessing* AudioProcessingBuilder::Create() {
24 webrtc::Config config;
25 return Create(config);
26}
27
28AudioProcessing* 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 AudioProcessingImpl* apm = 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 if (apm->Initialize() != AudioProcessing::kNoError) {
43 delete apm;
44 apm = nullptr;
45 }
46 return apm;
47
48#endif
49}
50
51} // namespace webrtc