Fixing a bug due to which the analog controller could not be disabled. AudioProcessing::Config::GainController1::AnalogGainController::enabled was ignored and therefore `recommended_stream_analog_level_locked()` in APM was returning the level recommended by `AgcManagerDirect`. When the analog controller is disabled, `stream_analog_level()` now returns the last value set via `set_stream_analog_level()`. However, the analog controller code is still running and, in particular, the existing metrics are reported as if the controller were enabled. This choice was made to reduce the risks of adding bugs in the digital compression gain selection part, which is tied to the analog controller. The metric drawback will be solved in a follow-up CL. Additional changes: - log `WebRTC.Audio.GainController.Analog.Enabled` when AGC1 is created or when its config changes - first step to replace "analog level" with "input volume" Bug: webrtc:7909, b/180019868 Change-Id: I28ce9556dd98f3dd9ad546799406c55478730435 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/270663 Reviewed-by: Per Åhgren <peah@webrtc.org> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38044}
195 lines
4.9 KiB
Plaintext
195 lines
4.9 KiB
Plaintext
# Copyright (c) 2018 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.
|
|
|
|
import("../../../webrtc.gni")
|
|
|
|
rtc_source_set("gain_control_interface") {
|
|
sources = [ "gain_control.h" ]
|
|
}
|
|
|
|
rtc_library("agc") {
|
|
sources = [
|
|
"agc_manager_direct.cc",
|
|
"agc_manager_direct.h",
|
|
]
|
|
configs += [ "..:apm_debug_dump" ]
|
|
deps = [
|
|
":clipping_predictor",
|
|
":clipping_predictor_evaluator",
|
|
":gain_control_interface",
|
|
":gain_map",
|
|
":level_estimation",
|
|
"..:api",
|
|
"..:apm_logging",
|
|
"..:audio_buffer",
|
|
"..:audio_frame_view",
|
|
"../../../api:array_view",
|
|
"../../../common_audio",
|
|
"../../../common_audio:common_audio_c",
|
|
"../../../rtc_base:checks",
|
|
"../../../rtc_base:gtest_prod",
|
|
"../../../rtc_base:logging",
|
|
"../../../rtc_base:safe_minmax",
|
|
"../../../system_wrappers:field_trial",
|
|
"../../../system_wrappers:metrics",
|
|
"../vad",
|
|
]
|
|
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
|
}
|
|
|
|
rtc_library("analog_gain_stats_reporter") {
|
|
sources = [
|
|
"analog_gain_stats_reporter.cc",
|
|
"analog_gain_stats_reporter.h",
|
|
]
|
|
deps = [
|
|
"../../../rtc_base:gtest_prod",
|
|
"../../../rtc_base:logging",
|
|
"../../../rtc_base:safe_minmax",
|
|
"../../../system_wrappers:metrics",
|
|
]
|
|
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
|
}
|
|
|
|
rtc_library("clipping_predictor") {
|
|
sources = [
|
|
"clipping_predictor.cc",
|
|
"clipping_predictor.h",
|
|
]
|
|
deps = [
|
|
":clipping_predictor_level_buffer",
|
|
":gain_map",
|
|
"..:api",
|
|
"..:audio_frame_view",
|
|
"../../../common_audio",
|
|
"../../../rtc_base:checks",
|
|
"../../../rtc_base:logging",
|
|
"../../../rtc_base:safe_minmax",
|
|
]
|
|
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
|
}
|
|
|
|
rtc_library("clipping_predictor_evaluator") {
|
|
sources = [
|
|
"clipping_predictor_evaluator.cc",
|
|
"clipping_predictor_evaluator.h",
|
|
]
|
|
deps = [
|
|
"../../../rtc_base:checks",
|
|
"../../../rtc_base:logging",
|
|
]
|
|
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
|
}
|
|
|
|
rtc_library("clipping_predictor_level_buffer") {
|
|
sources = [
|
|
"clipping_predictor_level_buffer.cc",
|
|
"clipping_predictor_level_buffer.h",
|
|
]
|
|
deps = [
|
|
"../../../rtc_base:checks",
|
|
"../../../rtc_base:logging",
|
|
]
|
|
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
|
}
|
|
|
|
rtc_library("level_estimation") {
|
|
sources = [
|
|
"agc.cc",
|
|
"agc.h",
|
|
"loudness_histogram.cc",
|
|
"loudness_histogram.h",
|
|
"utility.cc",
|
|
"utility.h",
|
|
]
|
|
deps = [
|
|
"../../../api:array_view",
|
|
"../../../rtc_base:checks",
|
|
"../vad",
|
|
]
|
|
}
|
|
|
|
rtc_library("legacy_agc") {
|
|
visibility = [
|
|
":*",
|
|
"..:*",
|
|
] # Only targets in this file and in
|
|
# audio_processing can depend on
|
|
# this.
|
|
|
|
sources = [
|
|
"legacy/analog_agc.cc",
|
|
"legacy/analog_agc.h",
|
|
"legacy/digital_agc.cc",
|
|
"legacy/digital_agc.h",
|
|
"legacy/gain_control.h",
|
|
]
|
|
|
|
deps = [
|
|
"../../../common_audio",
|
|
"../../../common_audio:common_audio_c",
|
|
"../../../common_audio/third_party/ooura:fft_size_256",
|
|
"../../../rtc_base:checks",
|
|
"../../../system_wrappers",
|
|
]
|
|
|
|
if (rtc_build_with_neon) {
|
|
if (current_cpu != "arm64") {
|
|
# Enable compilation for the NEON instruction set.
|
|
suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
|
|
cflags = [ "-mfpu=neon" ]
|
|
}
|
|
}
|
|
}
|
|
|
|
rtc_source_set("gain_map") {
|
|
sources = [ "gain_map_internal.h" ]
|
|
}
|
|
|
|
if (rtc_include_tests) {
|
|
rtc_library("agc_unittests") {
|
|
testonly = true
|
|
sources = [
|
|
"agc_manager_direct_unittest.cc",
|
|
"analog_gain_stats_reporter_unittest.cc",
|
|
"clipping_predictor_evaluator_unittest.cc",
|
|
"clipping_predictor_level_buffer_unittest.cc",
|
|
"clipping_predictor_unittest.cc",
|
|
"loudness_histogram_unittest.cc",
|
|
"mock_agc.h",
|
|
]
|
|
configs += [ "..:apm_debug_dump" ]
|
|
|
|
deps = [
|
|
":agc",
|
|
":analog_gain_stats_reporter",
|
|
":clipping_predictor",
|
|
":clipping_predictor_evaluator",
|
|
":clipping_predictor_level_buffer",
|
|
":gain_control_interface",
|
|
":level_estimation",
|
|
"..:mocks",
|
|
"../../../api:array_view",
|
|
"../../../rtc_base:checks",
|
|
"../../../rtc_base:random",
|
|
"../../../rtc_base:safe_conversions",
|
|
"../../../rtc_base:safe_minmax",
|
|
"../../../rtc_base:stringutils",
|
|
"../../../system_wrappers:metrics",
|
|
"../../../test:field_trial",
|
|
"../../../test:fileutils",
|
|
"../../../test:test_support",
|
|
"//testing/gtest",
|
|
]
|
|
absl_deps = [
|
|
"//third_party/abseil-cpp/absl/strings",
|
|
"//third_party/abseil-cpp/absl/types:optional",
|
|
]
|
|
}
|
|
}
|