Add BuiltinAudioProcessingFactory
Its implementation is a copy of the AudioProcessingBuilder with intention to replace all usage of AudioProcessingBuilder with the BuiltingAudioProcessingFactory and thus get Environment with propagated field trials available for AudioProcessingImpl at construction. Bug: webrtc:369904700 Change-Id: Iee0eb112dd579402fcd5be56bf1054946179d1fb Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/365582 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#43242}
This commit is contained in:
parent
6d433affd7
commit
2dc95ba299
2
BUILD.gn
2
BUILD.gn
@ -638,7 +638,7 @@ if (rtc_include_tests && !build_with_chromium) {
|
|||||||
deps = [
|
deps = [
|
||||||
"api:compile_all_headers",
|
"api:compile_all_headers",
|
||||||
"api:rtc_api_unittests",
|
"api:rtc_api_unittests",
|
||||||
"api/audio/test:audio_api_unittests",
|
"api/audio:audio_api_unittests",
|
||||||
"api/audio_codecs/test:audio_codecs_api_unittests",
|
"api/audio_codecs/test:audio_codecs_api_unittests",
|
||||||
"api/numerics:numerics_unittests",
|
"api/numerics:numerics_unittests",
|
||||||
"api/task_queue:pending_task_safety_flag_unittests",
|
"api/task_queue:pending_task_safety_flag_unittests",
|
||||||
|
|||||||
@ -99,6 +99,7 @@ if (!build_with_chromium) {
|
|||||||
"audio:audio_device",
|
"audio:audio_device",
|
||||||
"audio:audio_mixer_api",
|
"audio:audio_mixer_api",
|
||||||
"audio:audio_processing",
|
"audio:audio_processing",
|
||||||
|
"audio:builtin_audio_processing_factory",
|
||||||
"audio_codecs:audio_codecs_api",
|
"audio_codecs:audio_codecs_api",
|
||||||
"video_codecs:video_codecs_api",
|
"video_codecs:video_codecs_api",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -85,6 +85,26 @@ rtc_source_set("audio_processing") {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rtc_library("builtin_audio_processing_factory") {
|
||||||
|
visibility = [ "*" ]
|
||||||
|
configs += [ "../../modules/audio_processing:apm_debug_dump" ]
|
||||||
|
sources = [
|
||||||
|
"builtin_audio_processing_factory.cc",
|
||||||
|
"builtin_audio_processing_factory.h",
|
||||||
|
]
|
||||||
|
deps = [
|
||||||
|
":audio_processing",
|
||||||
|
":echo_control",
|
||||||
|
"..:make_ref_counted",
|
||||||
|
"..:scoped_refptr",
|
||||||
|
"../../modules/audio_processing",
|
||||||
|
"../../rtc_base:logging",
|
||||||
|
"../../rtc_base/system:rtc_export",
|
||||||
|
"../environment",
|
||||||
|
"//third_party/abseil-cpp/absl/base:nullability",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
rtc_source_set("audio_processing_statistics") {
|
rtc_source_set("audio_processing_statistics") {
|
||||||
visibility = [ "*" ]
|
visibility = [ "*" ]
|
||||||
sources = [
|
sources = [
|
||||||
@ -143,3 +163,19 @@ rtc_source_set("echo_detector_creator") {
|
|||||||
"../../modules/audio_processing:residual_echo_detector",
|
"../../modules/audio_processing:residual_echo_detector",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rtc_include_tests) {
|
||||||
|
rtc_library("audio_api_unittests") {
|
||||||
|
testonly = true
|
||||||
|
sources = [ "builtin_audio_processing_factory_unittest.cc" ]
|
||||||
|
deps = [
|
||||||
|
":audio_processing",
|
||||||
|
":builtin_audio_processing_factory",
|
||||||
|
"..:scoped_refptr",
|
||||||
|
"../../test:test_support",
|
||||||
|
"../environment",
|
||||||
|
"../environment:environment_factory",
|
||||||
|
"test:audio_api_unittests",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -771,6 +771,8 @@ class CustomProcessing {
|
|||||||
virtual ~CustomProcessing() {}
|
virtual ~CustomProcessing() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: bugs.webrtc.org/369904700 - Deprecate and remove in favor of the
|
||||||
|
// BuiltinAudioProcessingFactory.
|
||||||
class RTC_EXPORT AudioProcessingBuilder {
|
class RTC_EXPORT AudioProcessingBuilder {
|
||||||
public:
|
public:
|
||||||
AudioProcessingBuilder();
|
AudioProcessingBuilder();
|
||||||
|
|||||||
41
api/audio/builtin_audio_processing_factory.cc
Normal file
41
api/audio/builtin_audio_processing_factory.cc
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024 The WebRTC project authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by a BSD-style license
|
||||||
|
* that can be found in the LICENSE file in the root of the source
|
||||||
|
* tree. An additional intellectual property rights grant can be found
|
||||||
|
* in the file PATENTS. All contributing project authors may
|
||||||
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
|
*/
|
||||||
|
#include "api/audio/builtin_audio_processing_factory.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "absl/base/nullability.h"
|
||||||
|
#include "api/audio/audio_processing.h"
|
||||||
|
#include "api/environment/environment.h"
|
||||||
|
#include "api/make_ref_counted.h"
|
||||||
|
#include "api/scoped_refptr.h"
|
||||||
|
#include "modules/audio_processing/audio_processing_impl.h"
|
||||||
|
#include "rtc_base/logging.h"
|
||||||
|
|
||||||
|
namespace webrtc {
|
||||||
|
|
||||||
|
absl::Nullable<scoped_refptr<AudioProcessing>>
|
||||||
|
BuiltinAudioProcessingFactory::Create(const Environment& /*env*/) {
|
||||||
|
if (called_create_) {
|
||||||
|
RTC_DLOG(LS_ERROR)
|
||||||
|
<< "Calling BuiltinAudioProcessingFactory::Create more than once "
|
||||||
|
"is currently unsupported.";
|
||||||
|
}
|
||||||
|
called_create_ = true;
|
||||||
|
|
||||||
|
// TODO: bugs.webrtc.org/369904700 - Pass `env` when AudioProcessingImpl gets
|
||||||
|
// constructor that accepts it.
|
||||||
|
return make_ref_counted<AudioProcessingImpl>(
|
||||||
|
config_, std::move(capture_post_processing_),
|
||||||
|
std::move(render_pre_processing_), std::move(echo_control_factory_),
|
||||||
|
std::move(echo_detector_), std::move(capture_analyzer_));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace webrtc
|
||||||
98
api/audio/builtin_audio_processing_factory.h
Normal file
98
api/audio/builtin_audio_processing_factory.h
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024 The WebRTC project authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by a BSD-style license
|
||||||
|
* that can be found in the LICENSE file in the root of the source
|
||||||
|
* tree. An additional intellectual property rights grant can be found
|
||||||
|
* in the file PATENTS. All contributing project authors may
|
||||||
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef API_AUDIO_BUILTIN_AUDIO_PROCESSING_FACTORY_H_
|
||||||
|
#define API_AUDIO_BUILTIN_AUDIO_PROCESSING_FACTORY_H_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "absl/base/nullability.h"
|
||||||
|
#include "api/audio/audio_processing.h"
|
||||||
|
#include "api/audio/echo_control.h"
|
||||||
|
#include "api/environment/environment.h"
|
||||||
|
#include "api/scoped_refptr.h"
|
||||||
|
#include "rtc_base/system/rtc_export.h"
|
||||||
|
|
||||||
|
namespace webrtc {
|
||||||
|
|
||||||
|
class RTC_EXPORT BuiltinAudioProcessingFactory : public AudioProcessingFactory {
|
||||||
|
public:
|
||||||
|
BuiltinAudioProcessingFactory() = default;
|
||||||
|
explicit BuiltinAudioProcessingFactory(const AudioProcessing::Config& config)
|
||||||
|
: config_(config) {}
|
||||||
|
BuiltinAudioProcessingFactory(const BuiltinAudioProcessingFactory&) = delete;
|
||||||
|
BuiltinAudioProcessingFactory& operator=(
|
||||||
|
const BuiltinAudioProcessingFactory&) = delete;
|
||||||
|
~BuiltinAudioProcessingFactory() override = default;
|
||||||
|
|
||||||
|
// Sets the APM configuration.
|
||||||
|
BuiltinAudioProcessingFactory& SetConfig(
|
||||||
|
const AudioProcessing::Config& config) {
|
||||||
|
config_ = config;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets the echo controller factory to inject when APM is created.
|
||||||
|
BuiltinAudioProcessingFactory& SetEchoControlFactory(
|
||||||
|
std::unique_ptr<EchoControlFactory> echo_control_factory) {
|
||||||
|
echo_control_factory_ = std::move(echo_control_factory);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets the capture post-processing sub-module to inject when APM is created.
|
||||||
|
BuiltinAudioProcessingFactory& SetCapturePostProcessing(
|
||||||
|
std::unique_ptr<CustomProcessing> capture_post_processing) {
|
||||||
|
capture_post_processing_ = std::move(capture_post_processing);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets the render pre-processing sub-module to inject when APM is created.
|
||||||
|
BuiltinAudioProcessingFactory& SetRenderPreProcessing(
|
||||||
|
std::unique_ptr<CustomProcessing> render_pre_processing) {
|
||||||
|
render_pre_processing_ = std::move(render_pre_processing);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets the echo detector to inject when APM is created.
|
||||||
|
BuiltinAudioProcessingFactory& SetEchoDetector(
|
||||||
|
rtc::scoped_refptr<EchoDetector> echo_detector) {
|
||||||
|
echo_detector_ = std::move(echo_detector);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets the capture analyzer sub-module to inject when APM is created.
|
||||||
|
BuiltinAudioProcessingFactory& SetCaptureAnalyzer(
|
||||||
|
std::unique_ptr<CustomAudioAnalyzer> capture_analyzer) {
|
||||||
|
capture_analyzer_ = std::move(capture_analyzer);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creates an APM instance with the specified config or the default one if
|
||||||
|
// unspecified. Injects the specified components transferring the ownership
|
||||||
|
// to the newly created APM instance. This implementation of the
|
||||||
|
// AudioProcessingFactory interface is not designed to be used more than once.
|
||||||
|
// Calling `Create` second time would return an unspecified object.
|
||||||
|
absl::Nullable<scoped_refptr<AudioProcessing>> Create(
|
||||||
|
const Environment& env) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool called_create_ = false;
|
||||||
|
AudioProcessing::Config config_;
|
||||||
|
std::unique_ptr<EchoControlFactory> echo_control_factory_;
|
||||||
|
std::unique_ptr<CustomProcessing> capture_post_processing_;
|
||||||
|
std::unique_ptr<CustomProcessing> render_pre_processing_;
|
||||||
|
scoped_refptr<EchoDetector> echo_detector_;
|
||||||
|
std::unique_ptr<CustomAudioAnalyzer> capture_analyzer_;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace webrtc
|
||||||
|
|
||||||
|
#endif // API_AUDIO_BUILTIN_AUDIO_PROCESSING_FACTORY_H_
|
||||||
48
api/audio/builtin_audio_processing_factory_unittest.cc
Normal file
48
api/audio/builtin_audio_processing_factory_unittest.cc
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024 The WebRTC project authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by a BSD-style license
|
||||||
|
* that can be found in the LICENSE file in the root of the source
|
||||||
|
* tree. An additional intellectual property rights grant can be found
|
||||||
|
* in the file PATENTS. All contributing project authors may
|
||||||
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "api/audio/builtin_audio_processing_factory.h"
|
||||||
|
|
||||||
|
#include "api/audio/audio_processing.h"
|
||||||
|
#include "api/environment/environment.h"
|
||||||
|
#include "api/environment/environment_factory.h"
|
||||||
|
#include "api/scoped_refptr.h"
|
||||||
|
#include "test/gmock.h"
|
||||||
|
#include "test/gtest.h"
|
||||||
|
|
||||||
|
namespace webrtc {
|
||||||
|
|
||||||
|
using ::testing::NotNull;
|
||||||
|
|
||||||
|
TEST(BuiltinAudioProcessingFactoryTest, CreatesWithDefaults) {
|
||||||
|
EXPECT_THAT(BuiltinAudioProcessingFactory().Create(CreateEnvironment()),
|
||||||
|
NotNull());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(BuiltinAudioProcessingFactoryTest, CreatesWithConfig) {
|
||||||
|
const Environment env = CreateEnvironment();
|
||||||
|
AudioProcessing::Config config;
|
||||||
|
// Change a field to make config different to default one.
|
||||||
|
config.gain_controller1.enabled = !config.gain_controller1.enabled;
|
||||||
|
|
||||||
|
scoped_refptr<AudioProcessing> ap1 =
|
||||||
|
BuiltinAudioProcessingFactory(config).Create(env);
|
||||||
|
ASSERT_THAT(ap1, NotNull());
|
||||||
|
EXPECT_EQ(ap1->GetConfig().gain_controller1.enabled,
|
||||||
|
config.gain_controller1.enabled);
|
||||||
|
|
||||||
|
scoped_refptr<AudioProcessing> ap2 =
|
||||||
|
BuiltinAudioProcessingFactory().SetConfig(config).Create(env);
|
||||||
|
ASSERT_THAT(ap2, NotNull());
|
||||||
|
EXPECT_EQ(ap2->GetConfig().gain_controller1.enabled,
|
||||||
|
config.gain_controller1.enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace webrtc
|
||||||
@ -16,6 +16,7 @@
|
|||||||
#include "api/audio/audio_device.h"
|
#include "api/audio/audio_device.h"
|
||||||
#include "api/audio/audio_mixer.h"
|
#include "api/audio/audio_mixer.h"
|
||||||
#include "api/audio/audio_processing.h"
|
#include "api/audio/audio_processing.h"
|
||||||
|
#include "api/audio/builtin_audio_processing_factory.h"
|
||||||
#include "api/audio_codecs/audio_decoder_factory.h"
|
#include "api/audio_codecs/audio_decoder_factory.h"
|
||||||
#include "api/audio_codecs/audio_encoder_factory.h"
|
#include "api/audio_codecs/audio_encoder_factory.h"
|
||||||
#include "api/enable_media.h"
|
#include "api/enable_media.h"
|
||||||
@ -60,7 +61,10 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
|
|||||||
if (audio_processing) {
|
if (audio_processing) {
|
||||||
dependencies.audio_processing = std::move(audio_processing);
|
dependencies.audio_processing = std::move(audio_processing);
|
||||||
} else {
|
} else {
|
||||||
dependencies.audio_processing = AudioProcessingBuilder().Create();
|
#ifndef WEBRTC_EXCLUDE_AUDIO_PROCESSING_MODULE
|
||||||
|
dependencies.audio_processing_factory =
|
||||||
|
std::make_unique<BuiltinAudioProcessingFactory>();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
dependencies.audio_mixer = std::move(audio_mixer);
|
dependencies.audio_mixer = std::move(audio_mixer);
|
||||||
dependencies.video_encoder_factory = std::move(video_encoder_factory);
|
dependencies.video_encoder_factory = std::move(video_encoder_factory);
|
||||||
|
|||||||
@ -490,6 +490,7 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
|
|||||||
"../api:scoped_refptr",
|
"../api:scoped_refptr",
|
||||||
"../api:sequence_checker",
|
"../api:sequence_checker",
|
||||||
"../api/audio:audio_processing",
|
"../api/audio:audio_processing",
|
||||||
|
"../api/audio:builtin_audio_processing_factory",
|
||||||
"../api/audio_codecs:builtin_audio_decoder_factory",
|
"../api/audio_codecs:builtin_audio_decoder_factory",
|
||||||
"../api/audio_codecs:builtin_audio_encoder_factory",
|
"../api/audio_codecs:builtin_audio_encoder_factory",
|
||||||
"../api/rtc_event_log:rtc_event_log_factory",
|
"../api/rtc_event_log:rtc_event_log_factory",
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
#import "sdk/objc/helpers/RTCCameraPreviewView.h"
|
#import "sdk/objc/helpers/RTCCameraPreviewView.h"
|
||||||
|
|
||||||
#include "api/audio/audio_processing.h"
|
#include "api/audio/audio_processing.h"
|
||||||
|
#include "api/audio/builtin_audio_processing_factory.h"
|
||||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||||
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
||||||
#include "api/enable_media.h"
|
#include "api/enable_media.h"
|
||||||
@ -124,7 +125,7 @@ void ObjCCallClient::CreatePeerConnectionFactory() {
|
|||||||
[[RTC_OBJC_TYPE(RTCDefaultVideoEncoderFactory) alloc] init]);
|
[[RTC_OBJC_TYPE(RTCDefaultVideoEncoderFactory) alloc] init]);
|
||||||
dependencies.video_decoder_factory = webrtc::ObjCToNativeVideoDecoderFactory(
|
dependencies.video_decoder_factory = webrtc::ObjCToNativeVideoDecoderFactory(
|
||||||
[[RTC_OBJC_TYPE(RTCDefaultVideoDecoderFactory) alloc] init]);
|
[[RTC_OBJC_TYPE(RTCDefaultVideoDecoderFactory) alloc] init]);
|
||||||
dependencies.audio_processing = webrtc::AudioProcessingBuilder().Create();
|
dependencies.audio_processing_factory = std::make_unique<webrtc::BuiltinAudioProcessingFactory>();
|
||||||
webrtc::EnableMedia(dependencies);
|
webrtc::EnableMedia(dependencies);
|
||||||
dependencies.event_log_factory = std::make_unique<webrtc::RtcEventLogFactory>();
|
dependencies.event_log_factory = std::make_unique<webrtc::RtcEventLogFactory>();
|
||||||
pcf_ = webrtc::CreateModularPeerConnectionFactory(std::move(dependencies));
|
pcf_ = webrtc::CreateModularPeerConnectionFactory(std::move(dependencies));
|
||||||
|
|||||||
@ -347,7 +347,9 @@ if (rtc_include_tests) {
|
|||||||
"../../api/audio:aec3_factory",
|
"../../api/audio:aec3_factory",
|
||||||
"../../api/audio:audio_frame_api",
|
"../../api/audio:audio_frame_api",
|
||||||
"../../api/audio:audio_processing",
|
"../../api/audio:audio_processing",
|
||||||
|
"../../api/audio:builtin_audio_processing_factory",
|
||||||
"../../api/audio:echo_detector_creator",
|
"../../api/audio:echo_detector_creator",
|
||||||
|
"../../api/environment:environment_factory",
|
||||||
"../../common_audio",
|
"../../common_audio",
|
||||||
"../../common_audio:common_audio_c",
|
"../../common_audio:common_audio_c",
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
|
|||||||
@ -17,9 +17,10 @@
|
|||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
#include "api/audio/audio_processing.h"
|
#include "api/audio/audio_processing.h"
|
||||||
|
#include "api/audio/builtin_audio_processing_factory.h"
|
||||||
|
#include "api/environment/environment_factory.h"
|
||||||
#include "api/make_ref_counted.h"
|
#include "api/make_ref_counted.h"
|
||||||
#include "api/scoped_refptr.h"
|
#include "api/scoped_refptr.h"
|
||||||
#include "modules/audio_processing/test/audio_processing_builder_for_testing.h"
|
|
||||||
#include "modules/audio_processing/test/echo_canceller_test_tools.h"
|
#include "modules/audio_processing/test/echo_canceller_test_tools.h"
|
||||||
#include "modules/audio_processing/test/echo_control_mock.h"
|
#include "modules/audio_processing/test/echo_control_mock.h"
|
||||||
#include "modules/audio_processing/test/test_utils.h"
|
#include "modules/audio_processing/test/test_utils.h"
|
||||||
@ -198,8 +199,8 @@ TEST(AudioProcessingImplTest, AudioParameterChangeTriggersInit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(AudioProcessingImplTest, UpdateCapturePreGainRuntimeSetting) {
|
TEST(AudioProcessingImplTest, UpdateCapturePreGainRuntimeSetting) {
|
||||||
rtc::scoped_refptr<AudioProcessing> apm =
|
scoped_refptr<AudioProcessing> apm =
|
||||||
AudioProcessingBuilderForTesting().Create();
|
BuiltinAudioProcessingFactory().Create(CreateEnvironment());
|
||||||
webrtc::AudioProcessing::Config apm_config;
|
webrtc::AudioProcessing::Config apm_config;
|
||||||
apm_config.pre_amplifier.enabled = true;
|
apm_config.pre_amplifier.enabled = true;
|
||||||
apm_config.pre_amplifier.fixed_gain_factor = 1.f;
|
apm_config.pre_amplifier.fixed_gain_factor = 1.f;
|
||||||
@ -231,8 +232,8 @@ TEST(AudioProcessingImplTest, UpdateCapturePreGainRuntimeSetting) {
|
|||||||
|
|
||||||
TEST(AudioProcessingImplTest,
|
TEST(AudioProcessingImplTest,
|
||||||
LevelAdjustmentUpdateCapturePreGainRuntimeSetting) {
|
LevelAdjustmentUpdateCapturePreGainRuntimeSetting) {
|
||||||
rtc::scoped_refptr<AudioProcessing> apm =
|
scoped_refptr<AudioProcessing> apm =
|
||||||
AudioProcessingBuilderForTesting().Create();
|
BuiltinAudioProcessingFactory().Create(CreateEnvironment());
|
||||||
webrtc::AudioProcessing::Config apm_config;
|
webrtc::AudioProcessing::Config apm_config;
|
||||||
apm_config.capture_level_adjustment.enabled = true;
|
apm_config.capture_level_adjustment.enabled = true;
|
||||||
apm_config.capture_level_adjustment.pre_gain_factor = 1.f;
|
apm_config.capture_level_adjustment.pre_gain_factor = 1.f;
|
||||||
@ -264,8 +265,8 @@ TEST(AudioProcessingImplTest,
|
|||||||
|
|
||||||
TEST(AudioProcessingImplTest,
|
TEST(AudioProcessingImplTest,
|
||||||
LevelAdjustmentUpdateCapturePostGainRuntimeSetting) {
|
LevelAdjustmentUpdateCapturePostGainRuntimeSetting) {
|
||||||
rtc::scoped_refptr<AudioProcessing> apm =
|
scoped_refptr<AudioProcessing> apm =
|
||||||
AudioProcessingBuilderForTesting().Create();
|
BuiltinAudioProcessingFactory().Create(CreateEnvironment());
|
||||||
webrtc::AudioProcessing::Config apm_config;
|
webrtc::AudioProcessing::Config apm_config;
|
||||||
apm_config.capture_level_adjustment.enabled = true;
|
apm_config.capture_level_adjustment.enabled = true;
|
||||||
apm_config.capture_level_adjustment.post_gain_factor = 1.f;
|
apm_config.capture_level_adjustment.post_gain_factor = 1.f;
|
||||||
@ -302,10 +303,10 @@ TEST(AudioProcessingImplTest, EchoControllerObservesSetCaptureUsageChange) {
|
|||||||
const MockEchoControlFactory* echo_control_factory_ptr =
|
const MockEchoControlFactory* echo_control_factory_ptr =
|
||||||
echo_control_factory.get();
|
echo_control_factory.get();
|
||||||
|
|
||||||
rtc::scoped_refptr<AudioProcessing> apm =
|
scoped_refptr<AudioProcessing> apm =
|
||||||
AudioProcessingBuilderForTesting()
|
BuiltinAudioProcessingFactory()
|
||||||
.SetEchoControlFactory(std::move(echo_control_factory))
|
.SetEchoControlFactory(std::move(echo_control_factory))
|
||||||
.Create();
|
.Create(CreateEnvironment());
|
||||||
|
|
||||||
constexpr int16_t kAudioLevel = 10000;
|
constexpr int16_t kAudioLevel = 10000;
|
||||||
constexpr int kSampleRateHz = 48000;
|
constexpr int kSampleRateHz = 48000;
|
||||||
@ -384,10 +385,10 @@ TEST(AudioProcessingImplTest,
|
|||||||
auto echo_control_factory = std::make_unique<MockEchoControlFactory>();
|
auto echo_control_factory = std::make_unique<MockEchoControlFactory>();
|
||||||
const auto* echo_control_factory_ptr = echo_control_factory.get();
|
const auto* echo_control_factory_ptr = echo_control_factory.get();
|
||||||
|
|
||||||
rtc::scoped_refptr<AudioProcessing> apm =
|
scoped_refptr<AudioProcessing> apm =
|
||||||
AudioProcessingBuilderForTesting()
|
BuiltinAudioProcessingFactory()
|
||||||
.SetEchoControlFactory(std::move(echo_control_factory))
|
.SetEchoControlFactory(std::move(echo_control_factory))
|
||||||
.Create();
|
.Create(CreateEnvironment());
|
||||||
// Disable AGC.
|
// Disable AGC.
|
||||||
webrtc::AudioProcessing::Config apm_config;
|
webrtc::AudioProcessing::Config apm_config;
|
||||||
apm_config.gain_controller1.enabled = false;
|
apm_config.gain_controller1.enabled = false;
|
||||||
@ -427,10 +428,10 @@ TEST(AudioProcessingImplTest,
|
|||||||
auto echo_control_factory = std::make_unique<MockEchoControlFactory>();
|
auto echo_control_factory = std::make_unique<MockEchoControlFactory>();
|
||||||
const auto* echo_control_factory_ptr = echo_control_factory.get();
|
const auto* echo_control_factory_ptr = echo_control_factory.get();
|
||||||
|
|
||||||
rtc::scoped_refptr<AudioProcessing> apm =
|
scoped_refptr<AudioProcessing> apm =
|
||||||
AudioProcessingBuilderForTesting()
|
BuiltinAudioProcessingFactory()
|
||||||
.SetEchoControlFactory(std::move(echo_control_factory))
|
.SetEchoControlFactory(std::move(echo_control_factory))
|
||||||
.Create();
|
.Create(CreateEnvironment());
|
||||||
// Disable AGC.
|
// Disable AGC.
|
||||||
webrtc::AudioProcessing::Config apm_config;
|
webrtc::AudioProcessing::Config apm_config;
|
||||||
apm_config.gain_controller1.enabled = false;
|
apm_config.gain_controller1.enabled = false;
|
||||||
@ -470,10 +471,10 @@ TEST(AudioProcessingImplTest,
|
|||||||
auto echo_control_factory = std::make_unique<MockEchoControlFactory>();
|
auto echo_control_factory = std::make_unique<MockEchoControlFactory>();
|
||||||
const auto* echo_control_factory_ptr = echo_control_factory.get();
|
const auto* echo_control_factory_ptr = echo_control_factory.get();
|
||||||
|
|
||||||
rtc::scoped_refptr<AudioProcessing> apm =
|
scoped_refptr<AudioProcessing> apm =
|
||||||
AudioProcessingBuilderForTesting()
|
BuiltinAudioProcessingFactory()
|
||||||
.SetEchoControlFactory(std::move(echo_control_factory))
|
.SetEchoControlFactory(std::move(echo_control_factory))
|
||||||
.Create();
|
.Create(CreateEnvironment());
|
||||||
webrtc::AudioProcessing::Config apm_config;
|
webrtc::AudioProcessing::Config apm_config;
|
||||||
// Enable AGC1.
|
// Enable AGC1.
|
||||||
apm_config.gain_controller1.enabled = true;
|
apm_config.gain_controller1.enabled = true;
|
||||||
@ -525,10 +526,10 @@ TEST(AudioProcessingImplTest, EchoControllerObservesPlayoutVolumeChange) {
|
|||||||
auto echo_control_factory = std::make_unique<MockEchoControlFactory>();
|
auto echo_control_factory = std::make_unique<MockEchoControlFactory>();
|
||||||
const auto* echo_control_factory_ptr = echo_control_factory.get();
|
const auto* echo_control_factory_ptr = echo_control_factory.get();
|
||||||
|
|
||||||
rtc::scoped_refptr<AudioProcessing> apm =
|
scoped_refptr<AudioProcessing> apm =
|
||||||
AudioProcessingBuilderForTesting()
|
BuiltinAudioProcessingFactory()
|
||||||
.SetEchoControlFactory(std::move(echo_control_factory))
|
.SetEchoControlFactory(std::move(echo_control_factory))
|
||||||
.Create();
|
.Create(CreateEnvironment());
|
||||||
// Disable AGC.
|
// Disable AGC.
|
||||||
webrtc::AudioProcessing::Config apm_config;
|
webrtc::AudioProcessing::Config apm_config;
|
||||||
apm_config.gain_controller1.enabled = false;
|
apm_config.gain_controller1.enabled = false;
|
||||||
@ -582,11 +583,11 @@ TEST(AudioProcessingImplTest, RenderPreProcessorBeforeEchoDetector) {
|
|||||||
std::unique_ptr<CustomProcessing> test_render_pre_processor(
|
std::unique_ptr<CustomProcessing> test_render_pre_processor(
|
||||||
new TestRenderPreProcessor());
|
new TestRenderPreProcessor());
|
||||||
// Create APM injecting the test echo detector and render pre-processor.
|
// Create APM injecting the test echo detector and render pre-processor.
|
||||||
rtc::scoped_refptr<AudioProcessing> apm =
|
scoped_refptr<AudioProcessing> apm =
|
||||||
AudioProcessingBuilderForTesting()
|
BuiltinAudioProcessingFactory()
|
||||||
.SetEchoDetector(test_echo_detector)
|
.SetEchoDetector(test_echo_detector)
|
||||||
.SetRenderPreProcessing(std::move(test_render_pre_processor))
|
.SetRenderPreProcessing(std::move(test_render_pre_processor))
|
||||||
.Create();
|
.Create(CreateEnvironment());
|
||||||
webrtc::AudioProcessing::Config apm_config;
|
webrtc::AudioProcessing::Config apm_config;
|
||||||
apm_config.pre_amplifier.enabled = true;
|
apm_config.pre_amplifier.enabled = true;
|
||||||
apm->ApplyConfig(apm_config);
|
apm->ApplyConfig(apm_config);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user