tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 25cd2134b4d637fdc0fe877fc720c4fddf9107f3
parent c49ae10e7f29deafbb7d62ec7bec5da4fb2507c7
Author: Dan Baker <dbaker@mozilla.com>
Date:   Thu, 23 Oct 2025 14:42:55 -0600

Bug 1995393 - Vendor libwebrtc from 7acc29f017

Upstream commit: https://webrtc.googlesource.com/src/+/7acc29f017f67c83347428f526eca463cb73c985
    Introduce CreateTestEnvironment and update test/ to use it

    The helper proposed as primary way to construct Environment in tests
    Unlike prod CreateEnvironment it use command line base field trials by default.
    It also aware of test-only TimeController interface and make it simpler to use it.

    Bug: None
    Change-Id: If207a374a0dccc4f3f4064f0cbfccc63c4dc8f6f
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/403760
    Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
    Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
    Reviewed-by: Jeremy Leconte <jleconte@google.com>
    Cr-Commit-Position: refs/heads/main@{#45324}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/moz-patch-stack/s0027.patch | 14+++++++-------
Mthird_party/libwebrtc/moz-patch-stack/s0099.patch | 4++--
Mthird_party/libwebrtc/moz-patch-stack/s0102.patch | 4++--
Mthird_party/libwebrtc/test/BUILD.gn | 22+++++++++++++++++++++-
Mthird_party/libwebrtc/test/call_test.cc | 3++-
Athird_party/libwebrtc/test/create_test_environment.cc | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Athird_party/libwebrtc/test/create_test_environment.h | 42++++++++++++++++++++++++++++++++++++++++++
Mthird_party/libwebrtc/test/network/BUILD.gn | 1+
Mthird_party/libwebrtc/test/network/network_emulation_pc_unittest.cc | 4++--
Mthird_party/libwebrtc/test/pc/e2e/BUILD.gn | 1+
Mthird_party/libwebrtc/test/pc/e2e/test_peer_factory.cc | 8++++----
Mthird_party/libwebrtc/test/peer_scenario/BUILD.gn | 1+
Mthird_party/libwebrtc/test/peer_scenario/peer_scenario_client.cc | 10++++------
Mthird_party/libwebrtc/test/scenario/BUILD.gn | 1+
Mthird_party/libwebrtc/test/scenario/call_client.cc | 9++++-----
Mthird_party/libwebrtc/test/testsupport/ivf_video_frame_generator_unittest.cc | 4++--
Mthird_party/libwebrtc/test/video_codec_tester.cc | 11+++++------
Mthird_party/libwebrtc/test/video_codec_tester_unittest.cc | 13+++++++------
19 files changed, 175 insertions(+), 46 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 /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc -libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-23T20:40:11.118836+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-23T20:42:36.919937+00:00. # base of lastest vendoring -5d74f2147f +7acc29f017 diff --git a/third_party/libwebrtc/moz-patch-stack/s0027.patch b/third_party/libwebrtc/moz-patch-stack/s0027.patch @@ -1199,10 +1199,10 @@ index c1181618e9..4a772795ed 100644 deps += [ "..:logging", diff --git a/test/BUILD.gn b/test/BUILD.gn -index 4a6e127fc9..f6658eb8d1 100644 +index 2e8752ab0c..f9bcdf7a0d 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn -@@ -258,6 +258,7 @@ rtc_library("audio_test_common") { +@@ -277,6 +277,7 @@ rtc_library("audio_test_common") { ] } @@ -1210,7 +1210,7 @@ index 4a6e127fc9..f6658eb8d1 100644 if (!build_with_chromium) { if (is_mac || is_ios) { rtc_library("video_test_mac") { -@@ -313,8 +314,12 @@ if (!build_with_chromium) { +@@ -332,8 +333,12 @@ if (!build_with_chromium) { } } } @@ -1223,7 +1223,7 @@ index 4a6e127fc9..f6658eb8d1 100644 testonly = true sources = [ "rtcp_packet_parser.cc", -@@ -324,6 +329,7 @@ rtc_library("rtp_test_utils") { +@@ -343,6 +348,7 @@ rtc_library("rtp_test_utils") { "rtp_file_writer.cc", "rtp_file_writer.h", ] @@ -1231,7 +1231,7 @@ index 4a6e127fc9..f6658eb8d1 100644 deps = [ "../api:array_view", -@@ -503,7 +509,9 @@ rtc_library("video_frame_writer") { +@@ -522,7 +528,9 @@ rtc_library("video_frame_writer") { ] if (!is_ios) { @@ -1241,7 +1241,7 @@ index 4a6e127fc9..f6658eb8d1 100644 sources += [ "testsupport/jpeg_frame_writer.cc" ] } else { sources += [ "testsupport/jpeg_frame_writer_ios.cc" ] -@@ -1336,6 +1344,7 @@ if (!build_with_chromium) { +@@ -1357,6 +1365,7 @@ if (!build_with_chromium) { } } @@ -1249,7 +1249,7 @@ index 4a6e127fc9..f6658eb8d1 100644 if (!build_with_chromium && is_android) { rtc_android_library("native_test_java") { testonly = true -@@ -1378,6 +1387,7 @@ if (!build_with_chromium && is_android) { +@@ -1399,6 +1408,7 @@ if (!build_with_chromium && is_android) { sources = [ "android/org/webrtc/native_test/NativeTestWebrtc.java" ] } } 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 27d9d0056d..c78cdec7cc 100644 if (!build_with_mozilla) { diff --git a/test/BUILD.gn b/test/BUILD.gn -index f6658eb8d1..f5039000f6 100644 +index f9bcdf7a0d..f3d2496773 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn -@@ -470,6 +470,12 @@ rtc_source_set("test_support") { +@@ -489,6 +489,12 @@ rtc_source_set("test_support") { "//testing/gmock", "//testing/gtest", ] diff --git a/third_party/libwebrtc/moz-patch-stack/s0102.patch b/third_party/libwebrtc/moz-patch-stack/s0102.patch @@ -756,7 +756,7 @@ index 822b565610..f2ea548824 100644 import("../webrtc.gni") diff --git a/test/BUILD.gn b/test/BUILD.gn -index f5039000f6..27fbece69e 100644 +index f3d2496773..28ac646821 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -6,10 +6,10 @@ @@ -772,7 +772,7 @@ index f5039000f6..27fbece69e 100644 import("//third_party/jni_zero/jni_zero.gni") } -@@ -415,7 +415,7 @@ if (is_ios && !build_with_chromium) { +@@ -434,7 +434,7 @@ if (is_ios && !build_with_chromium) { testonly = true visibility = [ "*" ] sources = [ "ios/google_test_runner.mm" ] diff --git a/third_party/libwebrtc/test/BUILD.gn b/third_party/libwebrtc/test/BUILD.gn @@ -149,6 +149,25 @@ rtc_library("create_frame_generator_capturer") { ] } +rtc_library("create_test_environment") { + testonly = true + sources = [ + "create_test_environment.cc", + "create_test_environment.h", + ] + deps = [ + ":create_test_field_trials", + "../api:field_trials", + "../api:field_trials_view", + "../api:time_controller", + "../api/environment", + "../api/environment:environment_factory", + "../rtc_base:checks", + "//third_party/abseil-cpp/absl/base:nullability", + "//third_party/abseil-cpp/absl/strings:string_view", + ] +} + rtc_library("create_test_field_trials") { testonly = true sources = [ "create_test_field_trials.h" ] @@ -696,6 +715,7 @@ if (rtc_include_tests) { ":call_config_utils", ":copy_to_file_audio_capturer_unittest", ":create_frame_generator_capturer", + ":create_test_environment", ":create_test_field_trials", ":direct_transport", ":fake_video_codecs", @@ -1275,6 +1295,7 @@ if (!build_with_chromium) { ] deps = [ + ":create_test_environment", ":create_test_field_trials", ":direct_transport", ":encoder_settings", @@ -1449,7 +1470,6 @@ rtc_library("video_codec_tester") { "../api:make_ref_counted", "../api:scoped_refptr", "../api/environment", - "../api/environment:environment_factory", "../api/numerics", "../api/test/metrics:metric", "../api/test/metrics:metrics_logger", diff --git a/third_party/libwebrtc/test/call_test.cc b/third_party/libwebrtc/test/call_test.cc @@ -58,6 +58,7 @@ #include "modules/rtp_rtcp/source/rtp_packet_received.h" #include "rtc_base/checks.h" #include "rtc_base/task_queue_for_test.h" +#include "test/create_test_environment.h" #include "test/create_test_field_trials.h" #include "test/encoder_settings.h" #include "test/fake_decoder.h" @@ -75,7 +76,7 @@ namespace test { CallTest::CallTest(absl::string_view field_trials) : field_trials_(CreateTestFieldTrials(field_trials)), - env_(CreateEnvironment(&field_trials_)), + env_(CreateTestEnvironment({.field_trials = &field_trials_})), send_env_(env_), recv_env_(env_), audio_send_config_(/*send_transport=*/nullptr), diff --git a/third_party/libwebrtc/test/create_test_environment.cc b/third_party/libwebrtc/test/create_test_environment.cc @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2025 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 "test/create_test_environment.h" + +#include <memory> +#include <utility> +#include <variant> + +#include "absl/base/nullability.h" +#include "absl/strings/string_view.h" +#include "api/environment/environment.h" +#include "api/environment/environment_factory.h" +#include "api/field_trials.h" +#include "api/field_trials_view.h" +#include "rtc_base/checks.h" +#include "test/create_test_field_trials.h" + +namespace webrtc { +namespace { + +struct SetFieldTrials { + void operator()(absl::string_view field_trials) { + factory.Set(CreateTestFieldTrialsPtr(field_trials)); + } + + void operator()(FieldTrialsView* absl_nonnull field_trials) { + RTC_CHECK(field_trials != nullptr); + factory.Set(field_trials); + } + + void operator()(absl_nonnull std::unique_ptr<FieldTrialsView> field_trials) { + RTC_CHECK(field_trials != nullptr); + factory.Set(std::move(field_trials)); + } + + void operator()(FieldTrials field_trials) { + factory.Set(std::make_unique<FieldTrials>(std::move(field_trials))); + } + + EnvironmentFactory& factory; +}; + +} // namespace + +Environment CreateTestEnvironment(CreateTestEnvironmentOptions o) { + EnvironmentFactory factory; + + std::visit(SetFieldTrials{factory}, std::move(o.field_trials)); + + if (o.time != nullptr) { + factory.Set(o.time->GetClock()); + factory.Set(o.time->GetTaskQueueFactory()); + } + return factory.Create(); +} + +} // namespace webrtc diff --git a/third_party/libwebrtc/test/create_test_environment.h b/third_party/libwebrtc/test/create_test_environment.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2025 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_CREATE_TEST_ENVIRONMENT_H_ +#define TEST_CREATE_TEST_ENVIRONMENT_H_ + +#include <memory> +#include <variant> + +#include "absl/base/nullability.h" +#include "absl/strings/string_view.h" +#include "api/environment/environment.h" +#include "api/field_trials.h" +#include "api/field_trials_view.h" +#include "api/test/time_controller.h" + +namespace webrtc { + +// Creates Environment for unittests. Uses test specific defaults unlike the +// production CreateEnvironment. +// Supports test only interface TimeController for testing with simulated time. +// TODO: bugs.webrtc.org/437878267 - Remove `FieldTrialsView*` variant when +// tests are refactored not to rely on it. +struct CreateTestEnvironmentOptions { + std::variant<absl::string_view, + FieldTrialsView * absl_nonnull, + absl_nonnull std::unique_ptr<FieldTrialsView>, + FieldTrials> + field_trials; + TimeController* time = nullptr; +}; +Environment CreateTestEnvironment(CreateTestEnvironmentOptions o = {}); + +} // namespace webrtc + +#endif // TEST_CREATE_TEST_ENVIRONMENT_H_ diff --git a/third_party/libwebrtc/test/network/BUILD.gn b/third_party/libwebrtc/test/network/BUILD.gn @@ -102,6 +102,7 @@ if (rtc_include_tests && !build_with_chromium) { deps = [ ":emulated_network", ":simulated_network", + "..:create_test_environment", "..:test_support", "..:wait_until", "../../api:audio_options_api", diff --git a/third_party/libwebrtc/test/network/network_emulation_pc_unittest.cc b/third_party/libwebrtc/test/network/network_emulation_pc_unittest.cc @@ -16,7 +16,6 @@ #include "api/create_modular_peer_connection_factory.h" #include "api/enable_media_with_defaults.h" #include "api/environment/environment.h" -#include "api/environment/environment_factory.h" #include "api/jsep.h" #include "api/media_stream_interface.h" #include "api/peer_connection_interface.h" @@ -32,6 +31,7 @@ #include "pc/test/mock_peer_connection_observers.h" #include "rtc_base/task_queue_for_test.h" #include "rtc_base/thread.h" +#include "test/create_test_environment.h" #include "test/gmock.h" #include "test/gtest.h" #include "test/network/network_emulation.h" @@ -64,7 +64,7 @@ bool AddIceCandidates(PeerConnectionWrapper* peer, scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( Thread* signaling_thread, EmulatedNetworkManagerInterface* network) { - const Environment env = CreateEnvironment(); + const Environment env = CreateTestEnvironment(); PeerConnectionFactoryDependencies pcf_deps; pcf_deps.env = env; pcf_deps.event_log_factory = std::make_unique<RtcEventLogFactory>(); diff --git a/third_party/libwebrtc/test/pc/e2e/BUILD.gn b/third_party/libwebrtc/test/pc/e2e/BUILD.gn @@ -106,6 +106,7 @@ if (!build_with_chromium) { ":echo_emulation", ":test_peer", "../..:copy_to_file_audio_capturer", + "../..:create_test_environment", "../../../api:create_modular_peer_connection_factory", "../../../api:enable_media_with_defaults", "../../../api:libjingle_peerconnection_api", diff --git a/third_party/libwebrtc/test/pc/e2e/test_peer_factory.cc b/third_party/libwebrtc/test/pc/e2e/test_peer_factory.cc @@ -22,7 +22,6 @@ #include "api/create_modular_peer_connection_factory.h" #include "api/enable_media_with_defaults.h" #include "api/environment/environment.h" -#include "api/environment/environment_factory.h" #include "api/peer_connection_interface.h" #include "api/rtc_event_log/rtc_event_log_factory.h" #include "api/scoped_refptr.h" @@ -39,6 +38,7 @@ #include "rtc_base/checks.h" #include "rtc_base/system/file_wrapper.h" #include "rtc_base/thread.h" +#include "test/create_test_environment.h" #include "test/pc/e2e/analyzer/video/quality_analyzing_video_encoder.h" #include "test/pc/e2e/analyzer/video/video_quality_analyzer_injection_helper.h" #include "test/pc/e2e/echo/echo_emulation.h" @@ -292,9 +292,9 @@ std::unique_ptr<TestPeer> TestPeerFactory::CreateTestPeer( SetMandatoryEntities(components.get()); params->rtc_configuration.sdp_semantics = SdpSemantics::kUnifiedPlan; - const Environment env = CreateEnvironment( - std::move(components->pcf_dependencies->field_trials), - time_controller_.GetClock(), time_controller_.GetTaskQueueFactory()); + const Environment env = CreateTestEnvironment( + {.field_trials = std::move(components->pcf_dependencies->field_trials), + .time = &time_controller_}); // Create peer connection factory. scoped_refptr<AudioDeviceModule> audio_device_module = diff --git a/third_party/libwebrtc/test/peer_scenario/BUILD.gn b/third_party/libwebrtc/test/peer_scenario/BUILD.gn @@ -23,6 +23,7 @@ if (rtc_include_tests) { ] deps = [ "..:create_frame_generator_capturer", + "..:create_test_environment", "..:create_test_field_trials", "..:fake_video_codecs", "..:fileutils", diff --git a/third_party/libwebrtc/test/peer_scenario/peer_scenario_client.cc b/third_party/libwebrtc/test/peer_scenario/peer_scenario_client.cc @@ -26,8 +26,6 @@ #include "api/data_channel_interface.h" #include "api/enable_media_with_defaults.h" #include "api/environment/environment.h" -#include "api/environment/environment_factory.h" -#include "api/field_trials.h" #include "api/jsep.h" #include "api/make_ref_counted.h" #include "api/media_stream_interface.h" @@ -69,6 +67,7 @@ #include "rtc_base/logging.h" #include "rtc_base/thread.h" #include "test/create_frame_generator_capturer.h" +#include "test/create_test_environment.h" #include "test/fake_decoder.h" #include "test/fake_vp8_encoder.h" #include "test/frame_generator_capturer.h" @@ -242,10 +241,9 @@ PeerScenarioClient::PeerScenarioClient( Thread* signaling_thread, std::unique_ptr<LogWriterFactoryInterface> log_writer_factory, PeerScenarioClient::Config config) - : env_(CreateEnvironment( - std::make_unique<FieldTrials>(std::move(config.field_trials)), - net->time_controller()->GetClock(), - net->time_controller()->GetTaskQueueFactory())), + : env_( + CreateTestEnvironment({.field_trials = std::move(config.field_trials), + .time = net->time_controller()})), endpoints_(CreateEndpoints(net, config.endpoints)), signaling_thread_(signaling_thread), log_writer_factory_(std::move(log_writer_factory)), diff --git a/third_party/libwebrtc/test/scenario/BUILD.gn b/third_party/libwebrtc/test/scenario/BUILD.gn @@ -71,6 +71,7 @@ if (rtc_include_tests && !build_with_chromium) { ] deps = [ ":column_printer", + "..:create_test_environment", "..:create_test_field_trials", "..:encoder_settings", "..:frame_generator_capturer", diff --git a/third_party/libwebrtc/test/scenario/call_client.cc b/third_party/libwebrtc/test/scenario/call_client.cc @@ -20,7 +20,6 @@ #include "api/audio/builtin_audio_processing_builder.h" #include "api/environment/environment.h" #include "api/environment/environment_factory.h" -#include "api/field_trials.h" #include "api/media_types.h" #include "api/rtc_event_log/rtc_event_log.h" #include "api/rtc_event_log/rtc_event_log_factory.h" @@ -48,6 +47,7 @@ #include "rtc_base/event.h" #include "rtc_base/logging.h" #include "rtc_base/strings/string_builder.h" +#include "test/create_test_environment.h" #include "test/logging/log_writer.h" #include "test/scenario/column_printer.h" #include "test/scenario/network_node.h" @@ -235,10 +235,9 @@ CallClient::CallClient( std::unique_ptr<LogWriterFactoryInterface> log_writer_factory, CallClientConfig config) : time_controller_(time_controller), - env_(CreateEnvironment( - std::make_unique<FieldTrials>(std::move(config.field_trials)), - time_controller_->CreateTaskQueueFactory(), - time_controller_->GetClock())), + env_( + CreateTestEnvironment({.field_trials = std::move(config.field_trials), + .time = time_controller_})), log_writer_factory_(std::move(log_writer_factory)), network_controller_factory_(log_writer_factory_.get(), config.transport), task_queue_(env_.task_queue_factory().CreateTaskQueue( diff --git a/third_party/libwebrtc/test/testsupport/ivf_video_frame_generator_unittest.cc b/third_party/libwebrtc/test/testsupport/ivf_video_frame_generator_unittest.cc @@ -18,7 +18,6 @@ #include <vector> #include "api/environment/environment.h" -#include "api/environment/environment_factory.h" #include "api/scoped_refptr.h" #include "api/test/create_frame_generator.h" #include "api/test/frame_generator_interface.h" @@ -40,6 +39,7 @@ #include "rtc_base/event.h" #include "rtc_base/system/file_wrapper.h" #include "rtc_base/thread_annotations.h" +#include "test/create_test_environment.h" #include "test/gtest.h" #include "test/testsupport/file_utils.h" #include "test/video_codec_settings.h" @@ -170,7 +170,7 @@ class IvfVideoFrameGeneratorTest : public ::testing::Test { kMaxFrameEncodeWaitTimeout)); } - Environment env_ = CreateEnvironment(); + Environment env_ = CreateTestEnvironment(); std::string file_name_; std::vector<VideoFrame> video_frames_; }; diff --git a/third_party/libwebrtc/test/video_codec_tester.cc b/third_party/libwebrtc/test/video_codec_tester.cc @@ -33,7 +33,6 @@ #include "absl/strings/string_view.h" #include "api/array_view.h" #include "api/environment/environment.h" -#include "api/environment/environment_factory.h" #include "api/field_trials_view.h" #include "api/make_ref_counted.h" #include "api/numerics/samples_stats_counter.h" @@ -137,11 +136,11 @@ scoped_refptr<VideoFrameBuffer> ScaleFrame( // AV1 or H264) files. class VideoSource { public: - explicit VideoSource(VideoSourceSettings source_settings) + VideoSource(const Environment& env, VideoSourceSettings source_settings) : source_settings_(source_settings) { if (absl::EndsWith(source_settings.file_path, "ivf")) { - ivf_reader_ = CreateFromIvfFileFrameGenerator(CreateEnvironment(), - source_settings.file_path); + ivf_reader_ = + CreateFromIvfFileFrameGenerator(env, source_settings.file_path); } else if (absl::EndsWith(source_settings.file_path, "y4m")) { yuv_reader_ = CreateY4mFrameReader(source_settings_.file_path, @@ -1692,7 +1691,7 @@ VideoCodecTester::RunEncodeTest( VideoEncoderFactory* encoder_factory, const EncoderSettings& encoder_settings, const std::map<uint32_t, EncodingSettings>& encoding_settings) { - VideoSource video_source(source_settings); + VideoSource video_source(env, source_settings); std::unique_ptr<VideoCodecAnalyzer> analyzer = std::make_unique<VideoCodecAnalyzer>(); Encoder encoder(env, encoder_factory, encoder_settings, analyzer.get()); @@ -1721,7 +1720,7 @@ VideoCodecTester::RunEncodeDecodeTest( const EncoderSettings& encoder_settings, const DecoderSettings& decoder_settings, const std::map<uint32_t, EncodingSettings>& encoding_settings) { - VideoSource video_source(source_settings); + VideoSource video_source(env, source_settings); std::unique_ptr<VideoCodecAnalyzer> analyzer = std::make_unique<VideoCodecAnalyzer>(); const EncodingSettings& first_frame_settings = diff --git a/third_party/libwebrtc/test/video_codec_tester_unittest.cc b/third_party/libwebrtc/test/video_codec_tester_unittest.cc @@ -25,7 +25,6 @@ #include <vector> #include "api/environment/environment.h" -#include "api/environment/environment_factory.h" #include "api/scoped_refptr.h" #include "api/test/mock_video_decoder.h" #include "api/test/mock_video_decoder_factory.h" @@ -50,6 +49,7 @@ #include "modules/video_coding/include/video_codec_interface.h" #include "modules/video_coding/include/video_error_codes.h" #include "modules/video_coding/svc/scalability_mode_util.h" +#include "test/create_test_environment.h" #include "test/gmock.h" #include "test/gtest.h" #include "test/testsupport/file_utils.h" @@ -277,7 +277,7 @@ class VideoCodecTesterTest : public ::testing::Test { } protected: - const Environment env_ = CreateEnvironment(); + const Environment env_ = CreateTestEnvironment(); std::vector<std::unique_ptr<TestVideoDecoder>> decoders_; }; @@ -649,13 +649,13 @@ class VideoCodecTesterTestPacing void TearDown() override { remove(source_yuv_file_path_.c_str()); } protected: - const Environment env_ = CreateEnvironment(); + const Environment env_ = CreateTestEnvironment(); std::string source_yuv_file_path_; }; TEST_P(VideoCodecTesterTestPacing, PaceEncode) { auto [pacing_settings, expected_delta_ms] = GetParam(); - const Environment env = CreateEnvironment(); + const Environment env = CreateTestEnvironment(); VideoSourceSettings video_source{ .file_path = source_yuv_file_path_, .resolution = {.width = kSourceWidth, .height = kSourceHeight}, @@ -734,7 +734,8 @@ class VideoCodecTesterTestEncodingSettings TEST_P(VideoCodecTesterTestEncodingSettings, CreateEncodingSettings) { EncodingSettingsTestParameters test_params = GetParam(); EncodingSettings encoding_settings = VideoCodecTester::CreateEncodingSettings( - CreateEnvironment(), test_params.codec_type, test_params.scalability_mode, + CreateTestEnvironment(), test_params.codec_type, + test_params.scalability_mode, /*width=*/1280, /*height=*/720, test_params.bitrate, kFramerate); const std::map<LayerId, LayerSettings>& layers_settings = @@ -920,7 +921,7 @@ INSTANTIATE_TEST_SUITE_P( // TODO(webrtc:42225151): Add an IVF test stream and enable the test. TEST(VideoCodecTester, DISABLED_CompressedVideoSource) { - const Environment env = CreateEnvironment(); + const Environment env = CreateTestEnvironment(); std::unique_ptr<VideoEncoderFactory> encoder_factory = CreateBuiltinVideoEncoderFactory(); std::unique_ptr<VideoDecoderFactory> decoder_factory =