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/test/audio_processing_builder_for_testing.h" 12 13 #include <memory> 14 #include <utility> 15 16 #include "modules/audio_processing/audio_processing_impl.h" 17 18 namespace webrtc { 19 20 AudioProcessingBuilderForTesting::AudioProcessingBuilderForTesting() = default; 21 AudioProcessingBuilderForTesting::~AudioProcessingBuilderForTesting() = default; 22 23 #ifdef WEBRTC_EXCLUDE_AUDIO_PROCESSING_MODULE 24 Create()25rtc::scoped_refptr<AudioProcessing> AudioProcessingBuilderForTesting::Create() { 26 return rtc::make_ref_counted<AudioProcessingImpl>( 27 config_, std::move(capture_post_processing_), 28 std::move(render_pre_processing_), std::move(echo_control_factory_), 29 std::move(echo_detector_), std::move(capture_analyzer_)); 30 } 31 32 #else 33 Create()34rtc::scoped_refptr<AudioProcessing> AudioProcessingBuilderForTesting::Create() { 35 AudioProcessingBuilder builder; 36 TransferOwnershipsToBuilder(&builder); 37 return builder.SetConfig(config_).Create(); 38 } 39 40 #endif 41 TransferOwnershipsToBuilder(AudioProcessingBuilder * builder)42void AudioProcessingBuilderForTesting::TransferOwnershipsToBuilder( 43 AudioProcessingBuilder* builder) { 44 builder->SetCapturePostProcessing(std::move(capture_post_processing_)); 45 builder->SetRenderPreProcessing(std::move(render_pre_processing_)); 46 builder->SetEchoControlFactory(std::move(echo_control_factory_)); 47 builder->SetEchoDetector(std::move(echo_detector_)); 48 builder->SetCaptureAnalyzer(std::move(capture_analyzer_)); 49 } 50 51 } // namespace webrtc 52