commit 125bfba70452c078515be5745cba518ced5fe72d parent 48b3ba33af3ff1520edd71a47863e332c79776fc Author: Michael Froman <mfroman@mozilla.com> Date: Wed, 8 Oct 2025 17:39:49 -0500 Bug 1993083 - Vendor libwebrtc from e893a74fdd Upstream commit: https://webrtc.googlesource.com/src/+/e893a74fdd0f1fc861ec65f9e6cb4772e574aa17 Delete ExplicitKeyValueConfig alias In unittests where it was used populate FieldTrials with CreateTestFieldTrials instead to ensure those tests respect command line flag --force_fieldtrials. Bug: webrtc:419453427 Change-Id: Id3c4b44397ee627c096cbbf4b06a4ee2f9757131 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/398480 Auto-Submit: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#45054} Diffstat:
26 files changed, 101 insertions(+), 139 deletions(-)
diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor @@ -1,4 +1,4 @@ # ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc -libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-08T22:38:30.957733+00:00. +libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-08T22:39:36.400259+00:00. # base of lastest vendoring -fc3d84f832 +e893a74fdd diff --git a/third_party/libwebrtc/api/video_codecs/test/BUILD.gn b/third_party/libwebrtc/api/video_codecs/test/BUILD.gn @@ -30,6 +30,7 @@ if (rtc_include_tests) { "..:rtc_software_fallback_wrappers", "..:video_codecs_api", "../..:fec_controller_api", + "../..:field_trials", "../..:mock_video_encoder", "../..:rtp_parameters", "../../../api:scoped_refptr", @@ -39,7 +40,7 @@ if (rtc_include_tests) { "../../../modules/video_coding:webrtc_vp8", "../../../rtc_base:checks", "../../../rtc_base:rtc_base_tests_utils", - "../../../test:explicit_key_value_config", + "../../../test:create_test_field_trials", "../../../test:fake_video_codecs", "../../../test:test_support", "../../../test:video_test_common", diff --git a/third_party/libwebrtc/api/video_codecs/test/video_decoder_software_fallback_wrapper_unittest.cc b/third_party/libwebrtc/api/video_codecs/test/video_decoder_software_fallback_wrapper_unittest.cc @@ -18,6 +18,7 @@ #include "api/environment/environment.h" #include "api/environment/environment_factory.h" +#include "api/field_trials.h" #include "api/video/encoded_image.h" #include "api/video/video_frame.h" #include "api/video/video_frame_type.h" @@ -25,7 +26,7 @@ #include "modules/video_coding/codecs/vp8/include/vp8.h" #include "modules/video_coding/include/video_error_codes.h" #include "rtc_base/checks.h" -#include "test/explicit_key_value_config.h" +#include "test/create_test_field_trials.h" #include "test/gtest.h" namespace webrtc { @@ -36,7 +37,7 @@ class VideoDecoderSoftwareFallbackWrapperTest : public ::testing::Test { : VideoDecoderSoftwareFallbackWrapperTest("") {} explicit VideoDecoderSoftwareFallbackWrapperTest( const std::string& field_trials) - : field_trials_(field_trials), + : field_trials_(CreateTestFieldTrials(field_trials)), env_(CreateEnvironment(&field_trials_)), fake_decoder_(new CountingFakeDecoder()), fallback_wrapper_(CreateVideoDecoderSoftwareFallbackWrapper( @@ -78,7 +79,7 @@ class VideoDecoderSoftwareFallbackWrapperTest : public ::testing::Test { int release_count_ = 0; int reset_count_ = 0; }; - test::ExplicitKeyValueConfig field_trials_; + FieldTrials field_trials_; const Environment env_; // `fake_decoder_` is owned and released by `fallback_wrapper_`. CountingFakeDecoder* fake_decoder_; diff --git a/third_party/libwebrtc/api/video_codecs/test/video_encoder_software_fallback_wrapper_unittest.cc b/third_party/libwebrtc/api/video_codecs/test/video_encoder_software_fallback_wrapper_unittest.cc @@ -40,7 +40,7 @@ #include "modules/video_coding/include/video_error_codes.h" #include "modules/video_coding/utility/simulcast_rate_allocator.h" #include "rtc_base/fake_clock.h" -#include "test/explicit_key_value_config.h" +#include "test/create_test_field_trials.h" #include "test/fake_encoder.h" #include "test/fake_texture_frame.h" #include "test/gmock.h" @@ -49,7 +49,6 @@ namespace webrtc { namespace { -using test::ExplicitKeyValueConfig; using ::testing::_; using ::testing::Return; using ::testing::ValuesIn; @@ -560,19 +559,17 @@ class ForcedFallbackTest : public VideoEncoderSoftwareFallbackWrapperTestBase { class ForcedFallbackTestEnabled : public ForcedFallbackTest { public: ForcedFallbackTestEnabled() - : ForcedFallbackTest( - CreateEnvironment(std::make_unique<ExplicitKeyValueConfig>( - std::string(kFieldTrial) + "/Enabled-" + - std::to_string(kMinPixelsPerFrame) + "," + - std::to_string(kWidth * kHeight) + ",30000/"))) {} + : ForcedFallbackTest(CreateEnvironment(CreateTestFieldTrialsPtr( + std::string(kFieldTrial) + "/Enabled-" + + std::to_string(kMinPixelsPerFrame) + "," + + std::to_string(kWidth * kHeight) + ",30000/"))) {} }; class ForcedFallbackTestDisabled : public ForcedFallbackTest { public: ForcedFallbackTestDisabled() - : ForcedFallbackTest( - CreateEnvironment(std::make_unique<ExplicitKeyValueConfig>( - std::string(kFieldTrial) + "/Disabled/"))) {} + : ForcedFallbackTest(CreateEnvironment(CreateTestFieldTrialsPtr( + std::string(kFieldTrial) + "/Disabled/"))) {} }; TEST_F(ForcedFallbackTestDisabled, NoFallbackWithoutFieldTrial) { @@ -1144,8 +1141,8 @@ INSTANTIATE_TEST_SUITE_P( TEST_P(ResolutionBasedFallbackTest, VerifyForcedEncoderFallback) { const ResolutionBasedFallbackTestParams& params = GetParam(); - const Environment env = CreateEnvironment( - std::make_unique<ExplicitKeyValueConfig>(params.field_trials)); + const Environment env = + CreateEnvironment(CreateTestFieldTrialsPtr(params.field_trials)); auto primary = std::make_unique<test::FakeEncoder>(env); primary->SetImplementationName("primary"); auto fallback = std::make_unique<test::FakeEncoder>(env); diff --git a/third_party/libwebrtc/logging/BUILD.gn b/third_party/libwebrtc/logging/BUILD.gn @@ -600,6 +600,7 @@ if (rtc_enable_protobuf) { "../api:array_view", "../api:candidate", "../api:dtls_transport_interface", + "../api:field_trials", "../api:field_trials_view", "../api:libjingle_logging_api", "../api:rtc_event_log_output_file", @@ -626,7 +627,7 @@ if (rtc_enable_protobuf) { "../rtc_base:safe_conversions", "../rtc_base:timeutils", "../system_wrappers", - "../test:explicit_key_value_config", + "../test:create_test_field_trials", "../test:fileutils", "../test:test_support", "../test/logging:log_writer", diff --git a/third_party/libwebrtc/logging/rtc_event_log/encoder/rtc_event_log_encoder_unittest.cc b/third_party/libwebrtc/logging/rtc_event_log/encoder/rtc_event_log_encoder_unittest.cc @@ -23,6 +23,7 @@ #include <utility> #include <vector> +#include "api/field_trials.h" #include "api/field_trials_view.h" #include "api/rtc_event_log/rtc_event.h" #include "api/rtc_event_log/rtc_event_log.h" @@ -70,13 +71,11 @@ #include "rtc_base/numerics/safe_conversions.h" #include "rtc_base/random.h" #include "rtc_base/time_utils.h" -#include "test/explicit_key_value_config.h" +#include "test/create_test_field_trials.h" #include "test/gtest.h" namespace webrtc { -using test::ExplicitKeyValueConfig; - class RtcEventLogEncoderTest : public ::testing::TestWithParam< std::tuple<int, RtcEventLog::EncodingType, size_t, bool>> { @@ -92,7 +91,7 @@ class RtcEventLogEncoderTest ~RtcEventLogEncoderTest() override = default; std::unique_ptr<RtcEventLogEncoder> CreateEncoder( - const FieldTrialsView& field_trials = ExplicitKeyValueConfig("")) { + const FieldTrialsView& field_trials = CreateTestFieldTrials()) { std::unique_ptr<RtcEventLogEncoder> encoder; switch (encoding_type_) { case RtcEventLog::EncodingType::Legacy: @@ -1377,7 +1376,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtpPacketOutgoing) { TEST_P(RtcEventLogEncoderTest, RtcEventRtpPacketIncomingNoDependencyDescriptor) { - ExplicitKeyValueConfig no_dd( + FieldTrials no_dd = CreateTestFieldTrials( "WebRTC-RtcEventLogEncodeDependencyDescriptor/Disabled/"); std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder(no_dd); verifier_.ExpectDependencyDescriptorExtensionIsSet(false); @@ -1386,7 +1385,7 @@ TEST_P(RtcEventLogEncoderTest, TEST_P(RtcEventLogEncoderTest, RtcEventRtpPacketOutgoingNoDependencyDescriptor) { - ExplicitKeyValueConfig no_dd( + FieldTrials no_dd = CreateTestFieldTrials( "WebRTC-RtcEventLogEncodeDependencyDescriptor/Disabled/"); std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder(no_dd); verifier_.ExpectDependencyDescriptorExtensionIsSet(false); @@ -1447,7 +1446,7 @@ class RtcEventLogEncoderSimpleTest break; case RtcEventLog::EncodingType::NewFormat: encoder_ = std::make_unique<RtcEventLogEncoderNewFormat>( - ExplicitKeyValueConfig("")); + CreateTestFieldTrials()); break; case RtcEventLog::EncodingType::ProtoFree: encoder_ = std::make_unique<RtcEventLogEncoderV3>(); diff --git a/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_unittest.cc b/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_unittest.cc @@ -21,8 +21,8 @@ #include <utility> #include <vector> -#include "api/environment/environment.h" #include "api/environment/environment_factory.h" +#include "api/field_trials_view.h" #include "api/rtc_event_log/rtc_event_log_factory.h" #include "api/units/time_delta.h" #include "api/units/timestamp.h" @@ -61,7 +61,7 @@ #include "rtc_base/fake_clock.h" #include "rtc_base/random.h" #include "rtc_base/time_utils.h" -#include "test/explicit_key_value_config.h" +#include "test/create_test_field_trials.h" #include "test/gtest.h" #include "test/logging/log_writer.h" #include "test/logging/memory_log_writer.h" @@ -71,8 +71,6 @@ namespace webrtc { namespace { -using test::ExplicitKeyValueConfig; - struct EventCounts { size_t audio_send_streams = 0; size_t audio_recv_streams = 0; @@ -124,11 +122,9 @@ std::unique_ptr<FieldTrialsView> CreateFieldTrialsFor( RtcEventLog::EncodingType encoding_type) { switch (encoding_type) { case RtcEventLog::EncodingType::Legacy: - return std::make_unique<ExplicitKeyValueConfig>( - "WebRTC-RtcEventLogNewFormat/Disabled/"); + return CreateTestFieldTrialsPtr("WebRTC-RtcEventLogNewFormat/Disabled/"); case RtcEventLog::EncodingType::NewFormat: - return std::make_unique<ExplicitKeyValueConfig>( - "WebRTC-RtcEventLogNewFormat/Enabled/"); + return CreateTestFieldTrialsPtr("WebRTC-RtcEventLogNewFormat/Enabled/"); case RtcEventLog::EncodingType::ProtoFree: RTC_CHECK(false); return nullptr; diff --git a/third_party/libwebrtc/modules/audio_processing/aec3/BUILD.gn b/third_party/libwebrtc/modules/audio_processing/aec3/BUILD.gn @@ -314,6 +314,7 @@ if (rtc_include_tests) { "..:audio_processing", "..:high_pass_filter", "../../../api:array_view", + "../../../api:field_trials", "../../../api/audio:aec3_config", "../../../api/audio:echo_control", "../../../api/environment", @@ -325,7 +326,7 @@ if (rtc_include_tests) { "../../../rtc_base:stringutils", "../../../rtc_base/system:arch", "../../../system_wrappers:metrics", - "../../../test:explicit_key_value_config", + "../../../test:create_test_field_trials", "../../../test:test_support", "../utility:cascaded_biquad_filter", ] diff --git a/third_party/libwebrtc/modules/audio_processing/aec3/echo_canceller3_unittest.cc b/third_party/libwebrtc/modules/audio_processing/aec3/echo_canceller3_unittest.cc @@ -24,6 +24,7 @@ #include "api/audio/echo_control.h" #include "api/environment/environment.h" #include "api/environment/environment_factory.h" +#include "api/field_trials.h" #include "modules/audio_processing/aec3/aec3_common.h" #include "modules/audio_processing/aec3/block.h" #include "modules/audio_processing/aec3/block_processor.h" @@ -33,14 +34,13 @@ #include "modules/audio_processing/logging/apm_data_dumper.h" #include "rtc_base/checks.h" #include "rtc_base/strings/string_builder.h" -#include "test/explicit_key_value_config.h" +#include "test/create_test_field_trials.h" #include "test/gmock.h" #include "test/gtest.h" namespace webrtc { namespace { -using test::ExplicitKeyValueConfig; using ::testing::_; using ::testing::StrictMock; @@ -744,12 +744,12 @@ TEST(EchoCanceller3Messaging, EchoLeakage) { TEST(EchoCanceller3FieldTrials, Aec3SuppressorAntiHowlingGainOverride) { EchoCanceller3Config default_config; EchoCanceller3Config adjusted_config = - AdjustConfig(default_config, ExplicitKeyValueConfig("")); + AdjustConfig(default_config, CreateTestFieldTrials()); ASSERT_EQ( default_config.suppressor.high_bands_suppression.anti_howling_gain, adjusted_config.suppressor.high_bands_suppression.anti_howling_gain); - ExplicitKeyValueConfig field_trials( + FieldTrials field_trials = CreateTestFieldTrials( "WebRTC-Aec3SuppressorAntiHowlingGainOverride/0.02/"); adjusted_config = AdjustConfig(default_config, field_trials); @@ -766,12 +766,12 @@ TEST(EchoCanceller3FieldTrials, Aec3SuppressorAntiHowlingGainOverride) { TEST(EchoCanceller3FieldTrials, Aec3EnforceLowActiveRenderLimit) { EchoCanceller3Config default_config; EchoCanceller3Config adjusted_config = - AdjustConfig(default_config, ExplicitKeyValueConfig("")); + AdjustConfig(default_config, CreateTestFieldTrials()); ASSERT_EQ(default_config.render_levels.active_render_limit, adjusted_config.render_levels.active_render_limit); - ExplicitKeyValueConfig field_trials( - "WebRTC-Aec3EnforceLowActiveRenderLimit/Enabled/"); + FieldTrials field_trials = + CreateTestFieldTrials("WebRTC-Aec3EnforceLowActiveRenderLimit/Enabled/"); adjusted_config = AdjustConfig(default_config, field_trials); ASSERT_NE(default_config.render_levels.active_render_limit, @@ -782,7 +782,7 @@ TEST(EchoCanceller3FieldTrials, Aec3EnforceLowActiveRenderLimit) { // Testing the field trial-based override of the suppressor parameters for a // joint passing of all parameters. TEST(EchoCanceller3FieldTrials, Aec3SuppressorTuningOverrideAllParams) { - ExplicitKeyValueConfig field_trials( + FieldTrials field_trials = CreateTestFieldTrials( "WebRTC-Aec3SuppressorTuningOverride/" "nearend_tuning_mask_lf_enr_transparent:0.1,nearend_tuning_mask_lf_enr_" "suppress:0.2,nearend_tuning_mask_hf_enr_transparent:0.3,nearend_tuning_" @@ -877,7 +877,7 @@ TEST(EchoCanceller3FieldTrials, Aec3SuppressorTuningOverrideAllParams) { // Testing the field trial-based override of the suppressor parameters for // passing one parameter. TEST(EchoCanceller3FieldTrials, Aec3SuppressorTuningOverrideOneParam) { - ExplicitKeyValueConfig field_trials( + FieldTrials field_trials = CreateTestFieldTrials( "WebRTC-Aec3SuppressorTuningOverride/nearend_tuning_max_inc_factor:0.5/"); EchoCanceller3Config default_config; @@ -928,7 +928,7 @@ TEST(EchoCanceller3FieldTrials, Aec3SuppressorTuningOverrideOneParam) { // Testing the field trial-based that override the exponential decay parameters. TEST(EchoCanceller3FieldTrials, Aec3UseNearendReverb) { - ExplicitKeyValueConfig field_trials( + FieldTrials field_trials = CreateTestFieldTrials( "WebRTC-Aec3UseNearendReverbLen/default_len:0.9,nearend_len:0.8/"); EchoCanceller3Config default_config; EchoCanceller3Config adjusted_config = @@ -940,7 +940,7 @@ TEST(EchoCanceller3FieldTrials, Aec3UseNearendReverb) { // Testing the field trial-based that overrides the maximum allowed ecess render // blocks in the render buffering. TEST(EchoCanceller3FieldTrials, Aec3BufferingMaxAllowedExcessRenderBlocks) { - ExplicitKeyValueConfig field_trials( + FieldTrials field_trials = CreateTestFieldTrials( "WebRTC-Aec3BufferingMaxAllowedExcessRenderBlocksOverride/2/"); EchoCanceller3Config default_config; EchoCanceller3Config adjusted_config = diff --git a/third_party/libwebrtc/modules/remote_bitrate_estimator/BUILD.gn b/third_party/libwebrtc/modules/remote_bitrate_estimator/BUILD.gn @@ -170,6 +170,7 @@ if (rtc_include_tests) { ":remote_bitrate_estimator", ":transport_sequence_number_feedback_generator", "..:module_api_public", + "../../api:field_trials", "../../api:rtp_headers", "../../api/environment:environment_factory", "../../api/transport:bandwidth_usage", @@ -185,7 +186,7 @@ if (rtc_include_tests) { "../../rtc_base:random", "../../rtc_base/network:ecn_marking", "../../system_wrappers", - "../../test:explicit_key_value_config", + "../../test:create_test_field_trials", "../../test:fileutils", "../../test:test_support", "../pacing", diff --git a/third_party/libwebrtc/modules/remote_bitrate_estimator/aimd_rate_control_unittest.cc b/third_party/libwebrtc/modules/remote_bitrate_estimator/aimd_rate_control_unittest.cc @@ -11,19 +11,18 @@ #include <optional> +#include "api/field_trials.h" #include "api/transport/bandwidth_usage.h" #include "api/transport/network_types.h" #include "api/units/data_rate.h" #include "api/units/time_delta.h" #include "api/units/timestamp.h" -#include "test/explicit_key_value_config.h" +#include "test/create_test_field_trials.h" #include "test/gtest.h" namespace webrtc { namespace { -using test::ExplicitKeyValueConfig; - constexpr Timestamp kInitialTime = Timestamp::Millis(123'456); constexpr TimeDelta kMinBwePeriod = TimeDelta::Seconds(2); @@ -36,26 +35,26 @@ constexpr double kFractionAfterOveruse = 0.85; } // namespace TEST(AimdRateControlTest, MinNearMaxIncreaseRateOnLowBandwith) { - AimdRateControl aimd_rate_control(ExplicitKeyValueConfig("")); + AimdRateControl aimd_rate_control(CreateTestFieldTrials()); aimd_rate_control.SetEstimate(DataRate::BitsPerSec(30'000), kInitialTime); EXPECT_EQ(aimd_rate_control.GetNearMaxIncreaseRateBpsPerSecond(), 4'000); } TEST(AimdRateControlTest, NearMaxIncreaseRateIs5kbpsOn90kbpsAnd200msRtt) { - AimdRateControl aimd_rate_control(ExplicitKeyValueConfig("")); + AimdRateControl aimd_rate_control(CreateTestFieldTrials()); aimd_rate_control.SetEstimate(DataRate::BitsPerSec(90'000), kInitialTime); EXPECT_EQ(aimd_rate_control.GetNearMaxIncreaseRateBpsPerSecond(), 5'000); } TEST(AimdRateControlTest, NearMaxIncreaseRateIs5kbpsOn60kbpsAnd100msRtt) { - AimdRateControl aimd_rate_control(ExplicitKeyValueConfig("")); + AimdRateControl aimd_rate_control(CreateTestFieldTrials()); aimd_rate_control.SetEstimate(DataRate::BitsPerSec(60'000), kInitialTime); aimd_rate_control.SetRtt(TimeDelta::Millis(100)); EXPECT_EQ(aimd_rate_control.GetNearMaxIncreaseRateBpsPerSecond(), 5'000); } TEST(AimdRateControlTest, GetIncreaseRateAndBandwidthPeriod) { - AimdRateControl aimd_rate_control(ExplicitKeyValueConfig("")); + AimdRateControl aimd_rate_control(CreateTestFieldTrials()); constexpr DataRate kBitrate = DataRate::BitsPerSec(300'000); aimd_rate_control.SetEstimate(kBitrate, kInitialTime); aimd_rate_control.Update({BandwidthUsage::kBwOverusing, kBitrate}, @@ -66,7 +65,7 @@ TEST(AimdRateControlTest, GetIncreaseRateAndBandwidthPeriod) { } TEST(AimdRateControlTest, BweLimitedByAckedBitrate) { - AimdRateControl aimd_rate_control(ExplicitKeyValueConfig("")); + AimdRateControl aimd_rate_control(CreateTestFieldTrials()); constexpr DataRate kAckedBitrate = DataRate::BitsPerSec(10'000); Timestamp now = kInitialTime; aimd_rate_control.SetEstimate(kAckedBitrate, now); @@ -80,7 +79,7 @@ TEST(AimdRateControlTest, BweLimitedByAckedBitrate) { } TEST(AimdRateControlTest, BweNotLimitedByDecreasingAckedBitrate) { - AimdRateControl aimd_rate_control(ExplicitKeyValueConfig("")); + AimdRateControl aimd_rate_control(CreateTestFieldTrials()); constexpr DataRate kAckedBitrate = DataRate::BitsPerSec(10'000); Timestamp now = kInitialTime; aimd_rate_control.SetEstimate(kAckedBitrate, now); @@ -101,7 +100,7 @@ TEST(AimdRateControlTest, BweNotLimitedByDecreasingAckedBitrate) { } TEST(AimdRateControlTest, DefaultPeriodUntilFirstOveruse) { - AimdRateControl aimd_rate_control(ExplicitKeyValueConfig("")); + AimdRateControl aimd_rate_control(CreateTestFieldTrials()); aimd_rate_control.SetStartBitrate(DataRate::KilobitsPerSec(300)); EXPECT_EQ(aimd_rate_control.GetExpectedBandwidthPeriod(), kDefaultPeriod); aimd_rate_control.Update( @@ -111,7 +110,7 @@ TEST(AimdRateControlTest, DefaultPeriodUntilFirstOveruse) { } TEST(AimdRateControlTest, ExpectedPeriodAfterTypicalDrop) { - AimdRateControl aimd_rate_control(ExplicitKeyValueConfig("")); + AimdRateControl aimd_rate_control(CreateTestFieldTrials()); // The rate increase at 216 kbps should be 12 kbps. If we drop from // 216 + 4*12 = 264 kbps, it should take 4 seconds to recover. Since we // back off to 0.85*acked_rate-5kbps, the acked bitrate needs to be 260 @@ -131,7 +130,7 @@ TEST(AimdRateControlTest, ExpectedPeriodAfterTypicalDrop) { } TEST(AimdRateControlTest, BandwidthPeriodIsNotBelowMin) { - AimdRateControl aimd_rate_control(ExplicitKeyValueConfig("")); + AimdRateControl aimd_rate_control(CreateTestFieldTrials()); constexpr DataRate kInitialBitrate = DataRate::BitsPerSec(10'000); Timestamp now = kInitialTime; aimd_rate_control.SetEstimate(kInitialBitrate, now); @@ -144,7 +143,7 @@ TEST(AimdRateControlTest, BandwidthPeriodIsNotBelowMin) { } TEST(AimdRateControlTest, BandwidthPeriodIsNotAboveMaxNoSmoothingExp) { - AimdRateControl aimd_rate_control(ExplicitKeyValueConfig("")); + AimdRateControl aimd_rate_control(CreateTestFieldTrials()); constexpr DataRate kInitialBitrate = DataRate::BitsPerSec(10'010'000); Timestamp now = kInitialTime; aimd_rate_control.SetEstimate(kInitialBitrate, now); @@ -157,7 +156,7 @@ TEST(AimdRateControlTest, BandwidthPeriodIsNotAboveMaxNoSmoothingExp) { } TEST(AimdRateControlTest, SendingRateBoundedWhenThroughputNotEstimated) { - AimdRateControl aimd_rate_control(ExplicitKeyValueConfig("")); + AimdRateControl aimd_rate_control(CreateTestFieldTrials()); constexpr DataRate kInitialBitrate = DataRate::BitsPerSec(123'000); Timestamp now = kInitialTime; aimd_rate_control.Update({BandwidthUsage::kBwNormal, kInitialBitrate}, now); @@ -180,8 +179,8 @@ TEST(AimdRateControlTest, EstimateDoesNotIncreaseInAlr) { // When alr is detected, the delay based estimator is not allowed to increase // bwe since there will be no feedback from the network if the new estimate // is correct. - ExplicitKeyValueConfig field_trials( - "WebRTC-DontIncreaseDelayBasedBweInAlr/Enabled/"); + FieldTrials field_trials = + CreateTestFieldTrials("WebRTC-DontIncreaseDelayBasedBweInAlr/Enabled/"); AimdRateControl aimd_rate_control(field_trials, /*send_side=*/true); Timestamp now = kInitialTime; constexpr DataRate kInitialBitrate = DataRate::BitsPerSec(123'000); @@ -198,8 +197,8 @@ TEST(AimdRateControlTest, EstimateDoesNotIncreaseInAlr) { } TEST(AimdRateControlTest, SetEstimateIncreaseBweInAlr) { - ExplicitKeyValueConfig field_trials( - "WebRTC-DontIncreaseDelayBasedBweInAlr/Enabled/"); + FieldTrials field_trials = + CreateTestFieldTrials("WebRTC-DontIncreaseDelayBasedBweInAlr/Enabled/"); AimdRateControl aimd_rate_control(field_trials, /*send_side=*/true); constexpr DataRate kInitialBitrate = DataRate::BitsPerSec(123'000); aimd_rate_control.SetEstimate(kInitialBitrate, kInitialTime); @@ -210,7 +209,7 @@ TEST(AimdRateControlTest, SetEstimateIncreaseBweInAlr) { } TEST(AimdRateControlTest, SetEstimateUpperLimitedByNetworkEstimate) { - AimdRateControl aimd_rate_control(ExplicitKeyValueConfig(""), + AimdRateControl aimd_rate_control(CreateTestFieldTrials(), /*send_side=*/true); aimd_rate_control.SetEstimate(DataRate::BitsPerSec(300'000), kInitialTime); NetworkStateEstimate network_estimate; @@ -223,7 +222,7 @@ TEST(AimdRateControlTest, SetEstimateUpperLimitedByNetworkEstimate) { TEST(AimdRateControlTest, SetEstimateDefaultUpperLimitedByCurrentBitrateIfNetworkEstimateIsLow) { - AimdRateControl aimd_rate_control(ExplicitKeyValueConfig(""), + AimdRateControl aimd_rate_control(CreateTestFieldTrials(), /*send_side=*/true); aimd_rate_control.SetEstimate(DataRate::BitsPerSec(500'000), kInitialTime); ASSERT_EQ(aimd_rate_control.LatestEstimate(), DataRate::BitsPerSec(500'000)); @@ -238,7 +237,7 @@ TEST(AimdRateControlTest, TEST(AimdRateControlTest, SetEstimateNotUpperLimitedByCurrentBitrateIfNetworkEstimateIsLowIf) { AimdRateControl aimd_rate_control( - ExplicitKeyValueConfig( + CreateTestFieldTrials( "WebRTC-Bwe-EstimateBoundedIncrease/c_upper:false/"), /*send_side=*/true); @@ -253,7 +252,7 @@ TEST(AimdRateControlTest, } TEST(AimdRateControlTest, SetEstimateLowerLimitedByNetworkEstimate) { - AimdRateControl aimd_rate_control(ExplicitKeyValueConfig(""), + AimdRateControl aimd_rate_control(CreateTestFieldTrials(), /*send_side=*/true); NetworkStateEstimate network_estimate; network_estimate.link_capacity_lower = DataRate::BitsPerSec(400'000); @@ -266,7 +265,7 @@ TEST(AimdRateControlTest, SetEstimateLowerLimitedByNetworkEstimate) { TEST(AimdRateControlTest, SetEstimateIgnoredIfLowerThanNetworkEstimateAndCurrent) { - AimdRateControl aimd_rate_control(ExplicitKeyValueConfig(""), + AimdRateControl aimd_rate_control(CreateTestFieldTrials(), /*send_side=*/true); aimd_rate_control.SetEstimate(DataRate::KilobitsPerSec(200), kInitialTime); ASSERT_EQ(aimd_rate_control.LatestEstimate().kbps(), 200); @@ -282,8 +281,8 @@ TEST(AimdRateControlTest, TEST(AimdRateControlTest, EstimateIncreaseWhileNotInAlr) { // Allow the estimate to increase as long as alr is not detected to ensure // tha BWE can not get stuck at a certain bitrate. - ExplicitKeyValueConfig field_trials( - "WebRTC-DontIncreaseDelayBasedBweInAlr/Enabled/"); + FieldTrials field_trials = + CreateTestFieldTrials("WebRTC-DontIncreaseDelayBasedBweInAlr/Enabled/"); AimdRateControl aimd_rate_control(field_trials, /*send_side=*/true); Timestamp now = kInitialTime; constexpr DataRate kInitialBitrate = DataRate::BitsPerSec(123'000); @@ -298,8 +297,8 @@ TEST(AimdRateControlTest, EstimateIncreaseWhileNotInAlr) { } TEST(AimdRateControlTest, EstimateNotLimitedByNetworkEstimateIfDisabled) { - ExplicitKeyValueConfig field_trials( - "WebRTC-Bwe-EstimateBoundedIncrease/Disabled/"); + FieldTrials field_trials = + CreateTestFieldTrials("WebRTC-Bwe-EstimateBoundedIncrease/Disabled/"); AimdRateControl aimd_rate_control(field_trials, /*send_side=*/true); Timestamp now = kInitialTime; constexpr DataRate kInitialBitrate = DataRate::BitsPerSec(123'000); diff --git a/third_party/libwebrtc/modules/rtp_rtcp/BUILD.gn b/third_party/libwebrtc/modules/rtp_rtcp/BUILD.gn @@ -689,6 +689,7 @@ if (rtc_include_tests) { "..:module_fec_api", "../../api:array_view", "../../api:create_time_controller", + "../../api:field_trials", "../../api:field_trials_registry", "../../api:field_trials_view", "../../api:frame_transformer_factory", @@ -753,7 +754,7 @@ if (rtc_include_tests) { "../../rtc_base/network:ecn_marking", "../../system_wrappers", "../../system_wrappers:metrics", - "../../test:explicit_key_value_config", + "../../test:create_test_field_trials", "../../test:mock_transport", "../../test:rtp_test_utils", "../../test:run_loop", diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc @@ -59,7 +59,7 @@ #include "rtc_base/random.h" #include "system_wrappers/include/clock.h" #include "system_wrappers/include/ntp_time.h" -#include "test/explicit_key_value_config.h" +#include "test/create_test_field_trials.h" #include "test/gmock.h" #include "test/gtest.h" @@ -67,7 +67,6 @@ namespace webrtc { namespace { using rtcp::ReceiveTimeInfo; -using test::ExplicitKeyValueConfig; using ::testing::_; using ::testing::AllOf; using ::testing::ElementsAre; @@ -185,11 +184,9 @@ struct ReceiverMocks { }; RTCPReceiver Create(ReceiverMocks& mocks) { - return RTCPReceiver( - CreateEnvironment( - &mocks.clock, - std::make_unique<test::ExplicitKeyValueConfig>(mocks.field_trials)), - mocks.config, &mocks.rtp_rtcp_impl); + return RTCPReceiver(CreateEnvironment(&mocks.clock, CreateTestFieldTrialsPtr( + mocks.field_trials)), + mocks.config, &mocks.rtp_rtcp_impl); } TEST(RtcpReceiverTest, BrokenPacketIsIgnored) { diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc @@ -21,6 +21,7 @@ #include "api/call/transport.h" #include "api/environment/environment.h" #include "api/environment/environment_factory.h" +#include "api/field_trials.h" #include "api/rtp_headers.h" #include "api/units/time_delta.h" #include "api/video/video_codec_type.h" @@ -40,7 +41,7 @@ #include "modules/video_coding/codecs/vp8/include/vp8_globals.h" #include "system_wrappers/include/clock.h" #include "system_wrappers/include/ntp_time.h" -#include "test/explicit_key_value_config.h" +#include "test/create_test_field_trials.h" #include "test/gmock.h" #include "test/gtest.h" #include "test/rtcp_packet_parser.h" @@ -210,7 +211,7 @@ class RtpRtcpImplTest : public ::testing::Test { sender_.impl_->SetSequenceNumber(kSequenceNumber); sender_.impl_->SetStorePacketsStatus(true, 100); - test::ExplicitKeyValueConfig field_trials(""); + FieldTrials field_trials = CreateTestFieldTrials(); RTPSenderVideo::Config video_config; video_config.clock = &clock_; video_config.rtp_sender = sender_.impl_->RtpSender(); diff --git a/third_party/libwebrtc/modules/video_coding/codecs/av1/BUILD.gn b/third_party/libwebrtc/modules/video_coding/codecs/av1/BUILD.gn @@ -114,7 +114,6 @@ if (rtc_include_tests) { "../../../../api/video_codecs:video_codecs_api", "../../../../rtc_base:checks", "../../../../test:create_test_field_trials", - "../../../../test:explicit_key_value_config", "../../../../test:test_support", ] diff --git a/third_party/libwebrtc/modules/video_coding/svc/BUILD.gn b/third_party/libwebrtc/modules/video_coding/svc/BUILD.gn @@ -156,7 +156,6 @@ if (rtc_include_tests) { "../../../api/video_codecs:video_codecs_api", "../../../rtc_base:checks", "../../../test:create_test_field_trials", - "../../../test:explicit_key_value_config", "../../../test:test_support", "../codecs/av1:av1_svc_config", "//third_party/abseil-cpp/absl/container:inlined_vector", diff --git a/third_party/libwebrtc/moz-patch-stack/s0027.patch b/third_party/libwebrtc/moz-patch-stack/s0027.patch @@ -816,7 +816,7 @@ index a920be33f7..8d53cdfa0a 100644 testonly = true diff --git a/modules/audio_processing/aec3/BUILD.gn b/modules/audio_processing/aec3/BUILD.gn -index c7d983bcfa..6cc9d4c334 100644 +index 0ebeecd30f..4d7dc5d9cb 100644 --- a/modules/audio_processing/aec3/BUILD.gn +++ b/modules/audio_processing/aec3/BUILD.gn @@ -263,14 +263,11 @@ if (current_cpu == "x86" || current_cpu == "x64") { @@ -1194,7 +1194,7 @@ index c1181618e9..4a772795ed 100644 deps += [ "..:logging", diff --git a/test/BUILD.gn b/test/BUILD.gn -index c90d42d6e1..e0bb8bc2da 100644 +index c65a46417a..347975c8c5 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -258,6 +258,7 @@ rtc_library("audio_test_common") { @@ -1226,7 +1226,7 @@ index c90d42d6e1..e0bb8bc2da 100644 deps = [ "../api:array_view", -@@ -509,7 +515,9 @@ rtc_library("video_frame_writer") { +@@ -503,7 +509,9 @@ rtc_library("video_frame_writer") { ] if (!is_ios) { @@ -1236,7 +1236,7 @@ index c90d42d6e1..e0bb8bc2da 100644 sources += [ "testsupport/jpeg_frame_writer.cc" ] } else { sources += [ "testsupport/jpeg_frame_writer_ios.cc" ] -@@ -1350,6 +1358,7 @@ if (!build_with_chromium) { +@@ -1344,6 +1352,7 @@ if (!build_with_chromium) { } } @@ -1244,7 +1244,7 @@ index c90d42d6e1..e0bb8bc2da 100644 if (!build_with_chromium && is_android) { rtc_android_library("native_test_java") { testonly = true -@@ -1392,6 +1401,7 @@ if (!build_with_chromium && is_android) { +@@ -1386,6 +1395,7 @@ if (!build_with_chromium && is_android) { sources = [ "android/org/webrtc/native_test/NativeTestWebrtc.java" ] } } diff --git a/third_party/libwebrtc/moz-patch-stack/s0034.patch b/third_party/libwebrtc/moz-patch-stack/s0034.patch @@ -172,7 +172,7 @@ index ac862c65a8..e66ed2796e 100644 } else { sources += [ "spl_sqrt_floor.c" ] diff --git a/modules/audio_processing/aec3/BUILD.gn b/modules/audio_processing/aec3/BUILD.gn -index 6cc9d4c334..5102f92945 100644 +index 4d7dc5d9cb..847e5ccbea 100644 --- a/modules/audio_processing/aec3/BUILD.gn +++ b/modules/audio_processing/aec3/BUILD.gn @@ -123,7 +123,7 @@ rtc_library("aec3") { diff --git a/third_party/libwebrtc/moz-patch-stack/s0099.patch b/third_party/libwebrtc/moz-patch-stack/s0099.patch @@ -86,10 +86,10 @@ index 06da79a112..a18d353a0e 100644 if (!build_with_mozilla) { diff --git a/test/BUILD.gn b/test/BUILD.gn -index e0bb8bc2da..4038297072 100644 +index 347975c8c5..1117b2bb86 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn -@@ -476,6 +476,12 @@ rtc_source_set("test_support") { +@@ -470,6 +470,12 @@ rtc_source_set("test_support") { "//testing/gmock", "//testing/gtest", ] diff --git a/third_party/libwebrtc/moz-patch-stack/s0103.patch b/third_party/libwebrtc/moz-patch-stack/s0103.patch @@ -412,7 +412,7 @@ index 3f517b73c0..edf214e0c4 100644 deps = [ ":generated_jni", diff --git a/logging/BUILD.gn b/logging/BUILD.gn -index 65fe4b69f5..f091ff40cb 100644 +index 576980c5ab..2a8b864d5b 100644 --- a/logging/BUILD.gn +++ b/logging/BUILD.gn @@ -11,8 +11,8 @@ if (rtc_enable_protobuf) { @@ -455,7 +455,7 @@ index 8d53cdfa0a..181623546d 100644 config("audio_device_warnings_config") { diff --git a/modules/audio_processing/aec3/BUILD.gn b/modules/audio_processing/aec3/BUILD.gn -index 5102f92945..2e95f823fa 100644 +index 847e5ccbea..2f6be208d2 100644 --- a/modules/audio_processing/aec3/BUILD.gn +++ b/modules/audio_processing/aec3/BUILD.gn @@ -124,7 +124,7 @@ rtc_library("aec3") { @@ -756,7 +756,7 @@ index 8222263e1f..913382709e 100644 import("../webrtc.gni") diff --git a/test/BUILD.gn b/test/BUILD.gn -index 4038297072..c36ca05c5c 100644 +index 1117b2bb86..f9a36d94c9 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -6,10 +6,10 @@ @@ -772,7 +772,7 @@ index 4038297072..c36ca05c5c 100644 import("//third_party/jni_zero/jni_zero.gni") } -@@ -421,7 +421,7 @@ if (is_ios) { +@@ -415,7 +415,7 @@ if (is_ios) { testonly = true visibility = [ "*" ] sources = [ "ios/google_test_runner.mm" ] @@ -782,7 +782,7 @@ index 4038297072..c36ca05c5c 100644 deps = [ ":google_test_runner_delegate" ] } diff --git a/test/fuzzers/BUILD.gn b/test/fuzzers/BUILD.gn -index 62d0a537f4..8e5908a193 100644 +index d8f0eba11f..eb25867dc9 100644 --- a/test/fuzzers/BUILD.gn +++ b/test/fuzzers/BUILD.gn @@ -6,7 +6,7 @@ diff --git a/third_party/libwebrtc/p2p/BUILD.gn b/third_party/libwebrtc/p2p/BUILD.gn @@ -1006,6 +1006,7 @@ if (rtc_include_tests) { ":transport_description", "../api:array_view", "../api:candidate", + "../api:field_trials", "../api:ice_transport_interface", "../api:libjingle_peerconnection_api", "../api:sequence_checker", @@ -1026,7 +1027,7 @@ if (rtc_include_tests) { "../rtc_base:timeutils", "../rtc_base/network:received_packet", "../rtc_base/network:sent_packet", - "../test:explicit_key_value_config", + "../test:create_test_field_trials", "//third_party/abseil-cpp/absl/algorithm:container", "//third_party/abseil-cpp/absl/functional:any_invocable", "//third_party/abseil-cpp/absl/strings:string_view", @@ -1289,7 +1290,6 @@ if (rtc_include_tests) { "../rtc_base/third_party/sigslot", "../system_wrappers:metrics", "../test:create_test_field_trials", - "../test:explicit_key_value_config", "../test:test_support", "../test:wait_until", "//third_party/abseil-cpp/absl/algorithm:container", diff --git a/third_party/libwebrtc/p2p/test/fake_ice_transport.h b/third_party/libwebrtc/p2p/test/fake_ice_transport.h @@ -25,6 +25,7 @@ #include "absl/strings/string_view.h" #include "api/array_view.h" #include "api/candidate.h" +#include "api/field_trials.h" #include "api/ice_transport_interface.h" #include "api/sequence_checker.h" #include "api/task_queue/pending_task_safety_flag.h" @@ -51,7 +52,7 @@ #include "rtc_base/thread.h" #include "rtc_base/thread_annotations.h" #include "rtc_base/time_utils.h" -#include "test/explicit_key_value_config.h" +#include "test/create_test_field_trials.h" namespace webrtc { using ::webrtc::SafeTask; @@ -69,7 +70,7 @@ class FakeIceTransport : public IceTransportInternal { : name_(name), component_(component), network_thread_(network_thread ? network_thread : Thread::Current()), - field_trials_(field_trials_string) { + field_trials_(CreateTestFieldTrials(field_trials_string)) { RTC_DCHECK(network_thread_); } @@ -666,7 +667,7 @@ class FakeIceTransport : public IceTransportInternal { DtlsStunPiggybackCallbacks dtls_stun_piggyback_callbacks_; std::map<int, int> received_stun_messages_per_type; int received_packets_ = 0; - test::ExplicitKeyValueConfig field_trials_; + FieldTrials field_trials_; bool drop_non_stun_unless_writable_ = false; }; diff --git a/third_party/libwebrtc/test/BUILD.gn b/third_party/libwebrtc/test/BUILD.gn @@ -347,12 +347,6 @@ rtc_library("rtp_test_utils") { ] } -rtc_library("explicit_key_value_config") { - sources = [ "explicit_key_value_config.h" ] - - deps = [ "../api:field_trials" ] -} - rtc_library("perf_test") { visibility = [ "*" ] testonly = true diff --git a/third_party/libwebrtc/test/explicit_key_value_config.h b/third_party/libwebrtc/test/explicit_key_value_config.h @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2020 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 TEST_EXPLICIT_KEY_VALUE_CONFIG_H_ -#define TEST_EXPLICIT_KEY_VALUE_CONFIG_H_ - -#include "api/field_trials.h" - -namespace webrtc { -namespace test { - -// TODO: bugs.webrtc.org/42220378 - Use `FieldTrials` directly. -using ExplicitKeyValueConfig = FieldTrials; - -} // namespace test -} // namespace webrtc - -#endif // TEST_EXPLICIT_KEY_VALUE_CONFIG_H_ diff --git a/third_party/libwebrtc/test/fuzzers/BUILD.gn b/third_party/libwebrtc/test/fuzzers/BUILD.gn @@ -242,13 +242,13 @@ webrtc_fuzzer_test("rtcp_receiver_fuzzer") { sources = [ "rtcp_receiver_fuzzer.cc" ] deps = [ "../../api:array_view", + "../../api:field_trials", "../../api/environment", "../../api/environment:environment_factory", "../../modules/rtp_rtcp", "../../modules/rtp_rtcp:rtp_rtcp_format", "../../rtc_base:checks", "../../system_wrappers", - "../../test:explicit_key_value_config", ] seed_corpus = "corpora/rtcp-corpus" } diff --git a/third_party/libwebrtc/test/fuzzers/rtcp_receiver_fuzzer.cc b/third_party/libwebrtc/test/fuzzers/rtcp_receiver_fuzzer.cc @@ -14,12 +14,12 @@ #include "api/array_view.h" #include "api/environment/environment_factory.h" +#include "api/field_trials.h" #include "modules/rtp_rtcp/include/report_block_data.h" #include "modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h" #include "modules/rtp_rtcp/source/rtcp_receiver.h" #include "modules/rtp_rtcp/source/rtp_rtcp_interface.h" #include "system_wrappers/include/clock.h" -#include "test/explicit_key_value_config.h" namespace webrtc { namespace { @@ -45,8 +45,7 @@ void FuzzOneInput(const uint8_t* data, size_t size) { if (size > kMaxInputLenBytes) { return; } - test::ExplicitKeyValueConfig field_trials( - "WebRTC-RFC8888CongestionControlFeedback/Enabled/"); + FieldTrials field_trials("WebRTC-RFC8888CongestionControlFeedback/Enabled/"); NullModuleRtpRtcp rtp_rtcp_module; SimulatedClock clock(1234);