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 #ifndef MODULES_AUDIO_PROCESSING_OPTIONALLY_BUILT_SUBMODULE_CREATORS_H_ 12 #define MODULES_AUDIO_PROCESSING_OPTIONALLY_BUILT_SUBMODULE_CREATORS_H_ 13 14 #include <memory> 15 16 #include "modules/audio_processing/transient/transient_suppressor.h" 17 18 namespace webrtc { 19 20 // These overrides are only to be used for testing purposes. 21 // Each flag emulates a preprocessor macro to exclude a submodule of APM from 22 // the build, e.g. WEBRTC_EXCLUDE_TRANSIENT_SUPPRESSOR. If the corresponding 23 // flag |transient_suppression| is enabled, then the creators will return 24 // nullptr instead of a submodule instance, as if the macro had been defined. 25 struct ApmSubmoduleCreationOverrides { 26 bool transient_suppression = false; 27 }; 28 29 // Creates a transient suppressor. 30 // Will instead return nullptr if one of the following is true: 31 // * WEBRTC_EXCLUDE_TRANSIENT_SUPPRESSOR is defined 32 // * The corresponding override in |overrides| is enabled. 33 std::unique_ptr<TransientSuppressor> CreateTransientSuppressor( 34 const ApmSubmoduleCreationOverrides& overrides); 35 36 } // namespace webrtc 37 38 #endif // MODULES_AUDIO_PROCESSING_OPTIONALLY_BUILT_SUBMODULE_CREATORS_H_ 39