Poison global field trials
To ensure most of the WebRTC non-test code query propagated field trials rather than use global field trials string.
Bug: webrtc:42220378
Change-Id: I22cd767e5aab30b7598f42e334121ef2d7641ff2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/384620
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#44638}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 52df411..6e32258 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -319,7 +319,6 @@
":data_channel_event_observer_interface",
":dtls_transport_interface",
":fec_controller_api",
- ":field_trials",
":field_trials_view",
":frame_transformer_interface",
":ice_transport_interface",
diff --git a/api/transport/BUILD.gn b/api/transport/BUILD.gn
index 1dfce61..624788b 100644
--- a/api/transport/BUILD.gn
+++ b/api/transport/BUILD.gn
@@ -62,6 +62,7 @@
rtc_library("field_trial_based_config") {
visibility = [ "*" ]
+ allow_poison = [ "environment_construction" ]
sources = [
"field_trial_based_config.cc",
"field_trial_based_config.h",
diff --git a/media/BUILD.gn b/media/BUILD.gn
index 3386c58..0ba26c7e 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -174,7 +174,6 @@
"../rtc_base:timeutils",
"../rtc_base/synchronization:mutex",
"../rtc_base/system:rtc_export",
- "../system_wrappers:field_trial",
]
}
@@ -545,7 +544,6 @@
"../rtc_base:checks",
"../rtc_base:logging",
"../rtc_base/system:rtc_export",
- "../system_wrappers:field_trial",
"../test:fake_video_codecs",
"//third_party/abseil-cpp/absl/container:inlined_vector",
"//third_party/abseil-cpp/absl/strings",
@@ -779,7 +777,6 @@
deps += [
":rtc_data_dcsctp_transport",
"../system_wrappers",
- "../system_wrappers:field_trial",
]
}
}
diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn
index 31a21d3..d279433 100644
--- a/modules/audio_coding/BUILD.gn
+++ b/modules/audio_coding/BUILD.gn
@@ -435,7 +435,6 @@
"../../rtc_base:timeutils",
"../../rtc_base/system:file_wrapper",
"../../system_wrappers",
- "../../system_wrappers:field_trial",
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/strings:string_view",
]
diff --git a/modules/audio_device/BUILD.gn b/modules/audio_device/BUILD.gn
index 9c9083d..1bae257 100644
--- a/modules/audio_device/BUILD.gn
+++ b/modules/audio_device/BUILD.gn
@@ -291,7 +291,6 @@
"../../rtc_base/system:file_wrapper",
"../../rtc_base/task_utils:repeating_task",
"../../system_wrappers",
- "../../system_wrappers:field_trial",
"../../system_wrappers:metrics",
"../utility",
"//third_party/abseil-cpp/absl/base:core_headers",
diff --git a/modules/audio_processing/agc/BUILD.gn b/modules/audio_processing/agc/BUILD.gn
index 754b807..61a4509 100644
--- a/modules/audio_processing/agc/BUILD.gn
+++ b/modules/audio_processing/agc/BUILD.gn
@@ -34,7 +34,6 @@
"../../../rtc_base:gtest_prod",
"../../../rtc_base:logging",
"../../../rtc_base:safe_minmax",
- "../../../system_wrappers:field_trial",
"../../../system_wrappers:metrics",
"../agc2:clipping_predictor",
"../agc2:gain_map",
diff --git a/modules/audio_processing/agc2/BUILD.gn b/modules/audio_processing/agc2/BUILD.gn
index 3808a92..8660950 100644
--- a/modules/audio_processing/agc2/BUILD.gn
+++ b/modules/audio_processing/agc2/BUILD.gn
@@ -216,7 +216,6 @@
"../../../rtc_base:gtest_prod",
"../../../rtc_base:logging",
"../../../rtc_base:safe_minmax",
- "../../../system_wrappers:field_trial",
"../../../system_wrappers:metrics",
]
}
diff --git a/modules/audio_processing/agc2/input_volume_controller.cc b/modules/audio_processing/agc2/input_volume_controller.cc
index 557c1e6..20fd6dc 100644
--- a/modules/audio_processing/agc2/input_volume_controller.cc
+++ b/modules/audio_processing/agc2/input_volume_controller.cc
@@ -12,15 +12,19 @@
#include <algorithm>
#include <cmath>
+#include <cstddef>
+#include <memory>
+#include <optional>
-#include "api/array_view.h"
+#include "api/audio/audio_processing.h"
+#include "modules/audio_processing/agc2/clipping_predictor.h"
#include "modules/audio_processing/agc2/gain_map_internal.h"
#include "modules/audio_processing/agc2/input_volume_stats_reporter.h"
+#include "modules/audio_processing/audio_buffer.h"
#include "modules/audio_processing/include/audio_frame_view.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/safe_minmax.h"
-#include "system_wrappers/include/field_trial.h"
#include "system_wrappers/include/metrics.h"
namespace webrtc {
diff --git a/modules/audio_processing/ns/BUILD.gn b/modules/audio_processing/ns/BUILD.gn
index 90aedfa..e90ef0e 100644
--- a/modules/audio_processing/ns/BUILD.gn
+++ b/modules/audio_processing/ns/BUILD.gn
@@ -60,7 +60,6 @@
"../../../rtc_base:safe_minmax",
"../../../rtc_base/system:arch",
"../../../system_wrappers",
- "../../../system_wrappers:field_trial",
"../../../system_wrappers:metrics",
"../utility:cascaded_biquad_filter",
]
diff --git a/modules/congestion_controller/goog_cc/BUILD.gn b/modules/congestion_controller/goog_cc/BUILD.gn
index 3261686..f970a33 100644
--- a/modules/congestion_controller/goog_cc/BUILD.gn
+++ b/modules/congestion_controller/goog_cc/BUILD.gn
@@ -79,7 +79,6 @@
deps = [
"../../../api:field_trials_view",
"../../../api/rtc_event_log",
- "../../../api/transport:field_trial_based_config",
"../../../logging:rtc_event_pacing",
"../../../rtc_base:checks",
"../../../rtc_base:safe_conversions",
diff --git a/modules/congestion_controller/rtp/BUILD.gn b/modules/congestion_controller/rtp/BUILD.gn
index 302c3de..f9e230e 100644
--- a/modules/congestion_controller/rtp/BUILD.gn
+++ b/modules/congestion_controller/rtp/BUILD.gn
@@ -55,7 +55,6 @@
"../../../rtc_base/synchronization:mutex",
"../../../rtc_base/system:no_unique_address",
"../../../system_wrappers",
- "../../../system_wrappers:field_trial",
"../../rtp_rtcp:ntp_time_util",
"../../rtp_rtcp:rtp_rtcp_format",
"//third_party/abseil-cpp/absl/algorithm:container",
diff --git a/modules/pacing/BUILD.gn b/modules/pacing/BUILD.gn
index 21d529f..9faa33a 100644
--- a/modules/pacing/BUILD.gn
+++ b/modules/pacing/BUILD.gn
@@ -40,7 +40,6 @@
"../../api/rtc_event_log",
"../../api/task_queue:pending_task_safety_flag",
"../../api/task_queue:task_queue",
- "../../api/transport:field_trial_based_config",
"../../api/transport:network_control",
"../../api/units:data_rate",
"../../api/units:data_size",
diff --git a/p2p/BUILD.gn b/p2p/BUILD.gn
index a34e893..6971391 100644
--- a/p2p/BUILD.gn
+++ b/p2p/BUILD.gn
@@ -194,7 +194,6 @@
"../api:sequence_checker",
"../api/task_queue",
"../api/transport:enums",
- "../api/transport:field_trial_based_config",
"../api/transport:stun_types",
"../api/units:time_delta",
"../api/units:timestamp",
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index dc6a507..58addef 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -986,7 +986,6 @@
"../api/transport:ecn_marking",
"../api/units:time_delta",
"../api/units:timestamp",
- "../system_wrappers:field_trial",
"./network:ecn_marking",
"synchronization:mutex",
"system:no_unique_address",
@@ -1287,7 +1286,6 @@
"../api:sequence_checker",
"../api/units:time_delta",
"../api/units:timestamp",
- "../system_wrappers:field_trial",
"network:received_packet",
"network:sent_packet",
"system:no_unique_address",
diff --git a/rtc_base/experiments/BUILD.gn b/rtc_base/experiments/BUILD.gn
index 9f5573c..a9f5c7d 100644
--- a/rtc_base/experiments/BUILD.gn
+++ b/rtc_base/experiments/BUILD.gn
@@ -62,9 +62,10 @@
"quality_scaling_experiment.h",
]
deps = [
+ "..:checks",
"..:logging",
"../../api:field_trials_view",
- "../../api/transport:field_trial_based_config",
+ "../../api/video:video_frame",
"../../api/video_codecs:video_codecs_api",
"../../rtc_base/experiments:field_trial_parser",
"//third_party/abseil-cpp/absl/strings",
@@ -92,7 +93,6 @@
"..:logging",
"../../api:field_trials_view",
"../../api/video_codecs:video_codecs_api",
- "../../system_wrappers:field_trial",
]
}
diff --git a/rtc_base/experiments/quality_scaling_experiment.cc b/rtc_base/experiments/quality_scaling_experiment.cc
index be56363..30a80d3 100644
--- a/rtc_base/experiments/quality_scaling_experiment.cc
+++ b/rtc_base/experiments/quality_scaling_experiment.cc
@@ -11,11 +11,14 @@
#include <stdio.h>
+#include <optional>
#include <string>
#include "absl/strings/match.h"
#include "api/field_trials_view.h"
-#include "api/transport/field_trial_based_config.h"
+#include "api/video/video_codec_type.h"
+#include "api/video_codecs/video_encoder.h"
+#include "rtc_base/checks.h"
#include "rtc_base/experiments/field_trial_parser.h"
#include "rtc_base/logging.h"
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index c443527..417efe6 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -326,7 +326,6 @@
"../rtc_base:refcount",
"../rtc_base:threading",
"../rtc_base:timeutils",
- "../system_wrappers:field_trial",
"../system_wrappers:metrics",
]
diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn
index f778eeb..f1e7526 100644
--- a/sdk/android/BUILD.gn
+++ b/sdk/android/BUILD.gn
@@ -620,7 +620,6 @@
"../../rtc_base:refcount",
"../../rtc_base:stringutils",
"../../rtc_base:threading",
- "../../system_wrappers:field_trial",
"../../system_wrappers:metrics",
"//third_party/abseil-cpp/absl/strings:string_view",
"//third_party/jni_zero",
diff --git a/system_wrappers/BUILD.gn b/system_wrappers/BUILD.gn
index bb22946..c708f81 100644
--- a/system_wrappers/BUILD.gn
+++ b/system_wrappers/BUILD.gn
@@ -80,6 +80,7 @@
rtc_library("field_trial") {
visibility = [ "*" ]
+ poisonous = [ "environment_construction" ]
public = [ "include/field_trial.h" ]
sources = [ "source/field_trial.cc" ]
if (rtc_exclude_field_trial_default) {
diff --git a/video/BUILD.gn b/video/BUILD.gn
index 26be313..dec17dd 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -182,7 +182,6 @@
"../rtc_base/system:no_unique_address",
"../rtc_base/task_utils:repeating_task",
"../system_wrappers",
- "../system_wrappers:field_trial",
"../system_wrappers:metrics",
"../video/config:encoder_config",
"../video/corruption_detection:frame_instrumentation_evaluation",
@@ -277,7 +276,6 @@
"../rtc_base/system:unused",
"../rtc_base/task_utils:repeating_task",
"../system_wrappers",
- "../system_wrappers:field_trial",
"../system_wrappers:metrics",
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/base:core_headers",
@@ -319,7 +317,6 @@
"../rtc_base/experiments:field_trial_parser",
"../rtc_base/system:no_unique_address",
"../system_wrappers",
- "../system_wrappers:field_trial",
"//third_party/abseil-cpp/absl/base:core_headers",
"//third_party/abseil-cpp/absl/container:inlined_vector",
"//third_party/abseil-cpp/absl/functional:bind_front",