From 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:33 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- third_party/libwebrtc/rtc_tools/BUILD.gn | 17 +++----- .../libwebrtc/rtc_tools/network_tester/BUILD.gn | 2 +- .../rtc_tools/network_tester/config_reader.h | 3 -- .../rtc_tools/network_tester/packet_logger.h | 4 -- .../rtc_tools/network_tester/packet_sender.h | 3 -- .../libwebrtc/rtc_tools/network_tester/server.cc | 1 + .../rtc_tools/network_tester/test_controller.h | 5 +-- .../rtc_tools/rtc_event_log_visualizer/plot_base.h | 4 +- .../rtc_event_log_visualizer/plot_protobuf.cc | 43 -------------------- .../rtc_event_log_visualizer/plot_protobuf.h | 40 ------------------- .../rtc_event_log_visualizer/plot_python.cc | 46 ---------------------- .../rtc_event_log_visualizer/plot_python.h | 39 ------------------ .../rtc_tools/rtp_generator/rtp_generator.cc | 11 +++--- .../rtc_tools/rtp_generator/rtp_generator.h | 6 +-- .../libwebrtc/rtc_tools/unpack_aecdump/unpack.cc | 4 +- .../libwebrtc/rtc_tools/video_file_reader.h | 4 +- third_party/libwebrtc/rtc_tools/video_replay.cc | 41 +++++++------------ 17 files changed, 35 insertions(+), 238 deletions(-) delete mode 100644 third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_protobuf.cc delete mode 100644 third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_protobuf.h delete mode 100644 third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_python.cc delete mode 100644 third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_python.h (limited to 'third_party/libwebrtc/rtc_tools') diff --git a/third_party/libwebrtc/rtc_tools/BUILD.gn b/third_party/libwebrtc/rtc_tools/BUILD.gn index 7765cf522b..df3c55fec8 100644 --- a/third_party/libwebrtc/rtc_tools/BUILD.gn +++ b/third_party/libwebrtc/rtc_tools/BUILD.gn @@ -54,6 +54,7 @@ rtc_library("video_file_reader") { ] deps = [ "../api:make_ref_counted", + "../api:ref_count", "../api:scoped_refptr", "../api/video:video_frame", "../api/video:video_rtp_headers", @@ -203,9 +204,8 @@ if (!is_component_build) { "../api:create_frame_generator", "../api:rtp_parameters", "../api:transport_api", - "../api/rtc_event_log", - "../api/task_queue:default_task_queue_factory", - "../api/task_queue:task_queue", + "../api/environment", + "../api/environment:environment_factory", "../api/video:builtin_video_bitrate_allocator_factory", "../api/video_codecs:video_codecs_api", "../call", @@ -256,8 +256,8 @@ if (!is_component_build) { deps = [ "../api:field_trials", "../api:rtp_parameters", - "../api/rtc_event_log", - "../api/task_queue:default_task_queue_factory", + "../api/environment", + "../api/environment:environment_factory", "../api/test/video:function_video_factory", "../api/transport:field_trial_based_config", "../api/units:timestamp", @@ -272,7 +272,6 @@ if (!is_component_build) { "../rtc_base:checks", "../rtc_base:rtc_json", "../rtc_base:stringutils", - "../rtc_base:timeutils", "../system_wrappers", "../test:call_config_utils", "../test:encoder_settings", @@ -372,10 +371,6 @@ if (!build_with_chromium) { "rtc_event_log_visualizer/log_simulation.h", "rtc_event_log_visualizer/plot_base.cc", "rtc_event_log_visualizer/plot_base.h", - "rtc_event_log_visualizer/plot_protobuf.cc", - "rtc_event_log_visualizer/plot_protobuf.h", - "rtc_event_log_visualizer/plot_python.cc", - "rtc_event_log_visualizer/plot_python.h", ] deps = [ ":chart_proto", @@ -420,7 +415,6 @@ if (!build_with_chromium) { "../modules/rtp_rtcp", "../modules/rtp_rtcp:rtp_rtcp_format", "../rtc_base:checks", - "../rtc_base:ignore_wundef", "../rtc_base:logging", "../rtc_base:macromagic", "../rtc_base:rate_statistics", @@ -659,7 +653,6 @@ if (rtc_include_tests) { "../modules/audio_processing:audioproc_debug_proto", "../modules/audio_processing:audioproc_protobuf_utils", "../rtc_base:checks", - "../rtc_base:ignore_wundef", "../rtc_base:macromagic", "../rtc_base:protobuf_utils", "../rtc_base:stringutils", diff --git a/third_party/libwebrtc/rtc_tools/network_tester/BUILD.gn b/third_party/libwebrtc/rtc_tools/network_tester/BUILD.gn index efe2123510..5930431ab9 100644 --- a/third_party/libwebrtc/rtc_tools/network_tester/BUILD.gn +++ b/third_party/libwebrtc/rtc_tools/network_tester/BUILD.gn @@ -46,13 +46,13 @@ if (rtc_enable_protobuf) { "../../p2p:rtc_p2p", "../../rtc_base:async_packet_socket", "../../rtc_base:checks", - "../../rtc_base:ignore_wundef", "../../rtc_base:ip_address", "../../rtc_base:logging", "../../rtc_base:macromagic", "../../rtc_base:protobuf_utils", "../../rtc_base:rtc_task_queue", "../../rtc_base:socket_address", + "../../rtc_base:socket_server", "../../rtc_base:threading", "../../rtc_base:timeutils", "../../rtc_base/synchronization:mutex", diff --git a/third_party/libwebrtc/rtc_tools/network_tester/config_reader.h b/third_party/libwebrtc/rtc_tools/network_tester/config_reader.h index 3735555d51..3903613b5b 100644 --- a/third_party/libwebrtc/rtc_tools/network_tester/config_reader.h +++ b/third_party/libwebrtc/rtc_tools/network_tester/config_reader.h @@ -15,12 +15,9 @@ #include #include "absl/types/optional.h" -#include "rtc_base/ignore_wundef.h" #ifdef WEBRTC_NETWORK_TESTER_PROTO -RTC_PUSH_IGNORING_WUNDEF() #include "rtc_tools/network_tester/network_tester_config.pb.h" -RTC_POP_IGNORING_WUNDEF() using webrtc::network_tester::config::NetworkTesterAllConfigs; #else class NetworkTesterConfigs; diff --git a/third_party/libwebrtc/rtc_tools/network_tester/packet_logger.h b/third_party/libwebrtc/rtc_tools/network_tester/packet_logger.h index c3ac309cf7..c8bfccba10 100644 --- a/third_party/libwebrtc/rtc_tools/network_tester/packet_logger.h +++ b/third_party/libwebrtc/rtc_tools/network_tester/packet_logger.h @@ -14,12 +14,8 @@ #include #include -#include "rtc_base/ignore_wundef.h" - #ifdef WEBRTC_NETWORK_TESTER_PROTO -RTC_PUSH_IGNORING_WUNDEF() #include "rtc_tools/network_tester/network_tester_packet.pb.h" -RTC_POP_IGNORING_WUNDEF() using webrtc::network_tester::packet::NetworkTesterPacket; #else class NetworkTesterPacket; diff --git a/third_party/libwebrtc/rtc_tools/network_tester/packet_sender.h b/third_party/libwebrtc/rtc_tools/network_tester/packet_sender.h index 7fd500f27c..caa92499f3 100644 --- a/third_party/libwebrtc/rtc_tools/network_tester/packet_sender.h +++ b/third_party/libwebrtc/rtc_tools/network_tester/packet_sender.h @@ -17,13 +17,10 @@ #include "api/sequence_checker.h" #include "api/task_queue/pending_task_safety_flag.h" #include "api/task_queue/task_queue_factory.h" -#include "rtc_base/ignore_wundef.h" #include "rtc_base/system/no_unique_address.h" #ifdef WEBRTC_NETWORK_TESTER_PROTO -RTC_PUSH_IGNORING_WUNDEF() #include "rtc_tools/network_tester/network_tester_packet.pb.h" -RTC_POP_IGNORING_WUNDEF() using webrtc::network_tester::packet::NetworkTesterPacket; #else class NetworkTesterPacket; diff --git a/third_party/libwebrtc/rtc_tools/network_tester/server.cc b/third_party/libwebrtc/rtc_tools/network_tester/server.cc index f0f610a925..a6cd09fdca 100644 --- a/third_party/libwebrtc/rtc_tools/network_tester/server.cc +++ b/third_party/libwebrtc/rtc_tools/network_tester/server.cc @@ -9,6 +9,7 @@ */ #include "rtc_base/null_socket_server.h" +#include "rtc_base/thread.h" #include "rtc_tools/network_tester/test_controller.h" int main(int /*argn*/, char* /*argv*/[]) { diff --git a/third_party/libwebrtc/rtc_tools/network_tester/test_controller.h b/third_party/libwebrtc/rtc_tools/network_tester/test_controller.h index b08fbd5dd8..3638c75af1 100644 --- a/third_party/libwebrtc/rtc_tools/network_tester/test_controller.h +++ b/third_party/libwebrtc/rtc_tools/network_tester/test_controller.h @@ -22,19 +22,18 @@ #include "api/sequence_checker.h" #include "p2p/base/basic_packet_socket_factory.h" #include "rtc_base/async_packet_socket.h" -#include "rtc_base/ignore_wundef.h" #include "rtc_base/socket_address.h" +#include "rtc_base/socket_server.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/system/no_unique_address.h" #include "rtc_base/third_party/sigslot/sigslot.h" +#include "rtc_base/thread.h" #include "rtc_base/thread_annotations.h" #include "rtc_tools/network_tester/packet_logger.h" #include "rtc_tools/network_tester/packet_sender.h" #ifdef WEBRTC_NETWORK_TESTER_PROTO -RTC_PUSH_IGNORING_WUNDEF() #include "rtc_tools/network_tester/network_tester_packet.pb.h" -RTC_POP_IGNORING_WUNDEF() using webrtc::network_tester::packet::NetworkTesterPacket; #else class NetworkTesterPacket; diff --git a/third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_base.h b/third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_base.h index e970a6eeb8..aacffa4d59 100644 --- a/third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_base.h +++ b/third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_base.h @@ -19,11 +19,9 @@ #include "absl/base/attributes.h" #include "absl/strings/string_view.h" #include "absl/types/optional.h" -#include "rtc_base/ignore_wundef.h" -RTC_PUSH_IGNORING_WUNDEF() +// Generated at build-time by the protobuf compiler. #include "rtc_tools/rtc_event_log_visualizer/proto/chart.pb.h" -RTC_POP_IGNORING_WUNDEF() namespace webrtc { diff --git a/third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_protobuf.cc b/third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_protobuf.cc deleted file mode 100644 index 0b7a6f28ac..0000000000 --- a/third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_protobuf.cc +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2016 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 "rtc_tools/rtc_event_log_visualizer/plot_protobuf.h" - -#include - -#include -#include -#include - -namespace webrtc { - -ProtobufPlot::ProtobufPlot() {} - -ProtobufPlot::~ProtobufPlot() {} - -void ProtobufPlot::Draw() {} - -ProtobufPlotCollection::ProtobufPlotCollection() {} - -ProtobufPlotCollection::~ProtobufPlotCollection() {} - -void ProtobufPlotCollection::Draw() { - webrtc::analytics::ChartCollection collection; - ExportProtobuf(&collection); - std::cout << collection.SerializeAsString(); -} - -Plot* ProtobufPlotCollection::AppendNewPlot() { - Plot* plot = new ProtobufPlot(); - plots_.push_back(std::unique_ptr(plot)); - return plot; -} - -} // namespace webrtc diff --git a/third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_protobuf.h b/third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_protobuf.h deleted file mode 100644 index fbe68853a3..0000000000 --- a/third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_protobuf.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2016 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 RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_PROTOBUF_H_ -#define RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_PROTOBUF_H_ - -#include "absl/base/attributes.h" -#include "rtc_base/ignore_wundef.h" -RTC_PUSH_IGNORING_WUNDEF() -#include "rtc_tools/rtc_event_log_visualizer/proto/chart.pb.h" -RTC_POP_IGNORING_WUNDEF() -#include "rtc_tools/rtc_event_log_visualizer/plot_base.h" - -namespace webrtc { - -class ProtobufPlot final : public Plot { - public: - ProtobufPlot(); - ~ProtobufPlot() override; - void Draw() override; -}; - -class ABSL_DEPRECATED("Use PlotCollection and ExportProtobuf() instead") - ProtobufPlotCollection final : public PlotCollection { - public: - ProtobufPlotCollection(); - ~ProtobufPlotCollection() override; - void Draw() override; - Plot* AppendNewPlot() override; -}; - -} // namespace webrtc - -#endif // RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_PROTOBUF_H_ diff --git a/third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_python.cc b/third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_python.cc deleted file mode 100644 index b3708110df..0000000000 --- a/third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_python.cc +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2016 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 "rtc_tools/rtc_event_log_visualizer/plot_python.h" - -#include - -#include -#include -#include - -#include "rtc_base/checks.h" - -namespace webrtc { - -PythonPlot::PythonPlot() {} - -PythonPlot::~PythonPlot() {} - -void PythonPlot::Draw() { - PrintPythonCode(); -} - -PythonPlotCollection::PythonPlotCollection(bool shared_xaxis) - : shared_xaxis_(shared_xaxis) {} - -PythonPlotCollection::~PythonPlotCollection() {} - -void PythonPlotCollection::Draw() { - PrintPythonCode(shared_xaxis_); -} - -Plot* PythonPlotCollection::AppendNewPlot() { - Plot* plot = new PythonPlot(); - plots_.push_back(std::unique_ptr(plot)); - return plot; -} - -} // namespace webrtc diff --git a/third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_python.h b/third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_python.h deleted file mode 100644 index 6acc436d71..0000000000 --- a/third_party/libwebrtc/rtc_tools/rtc_event_log_visualizer/plot_python.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2016 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 RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_PYTHON_H_ -#define RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_PYTHON_H_ - -#include "absl/base/attributes.h" -#include "rtc_tools/rtc_event_log_visualizer/plot_base.h" - -namespace webrtc { - -class PythonPlot final : public Plot { - public: - PythonPlot(); - ~PythonPlot() override; - void Draw() override; -}; - -class ABSL_DEPRECATED("Use PlotCollection and PrintPythonCode() instead.") - PythonPlotCollection final : public PlotCollection { - public: - explicit PythonPlotCollection(bool shared_xaxis = false); - ~PythonPlotCollection() override; - void Draw() override; - Plot* AppendNewPlot() override; - - private: - bool shared_xaxis_; -}; - -} // namespace webrtc - -#endif // RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_PYTHON_H_ diff --git a/third_party/libwebrtc/rtc_tools/rtp_generator/rtp_generator.cc b/third_party/libwebrtc/rtc_tools/rtp_generator/rtp_generator.cc index e50c125876..0c6d3e3a48 100644 --- a/third_party/libwebrtc/rtc_tools/rtp_generator/rtp_generator.cc +++ b/third_party/libwebrtc/rtc_tools/rtp_generator/rtp_generator.cc @@ -14,7 +14,7 @@ #include #include -#include "api/task_queue/default_task_queue_factory.h" +#include "api/environment/environment_factory.h" #include "api/test/create_frame_generator.h" #include "api/video_codecs/video_decoder_factory_template.h" #include "api/video_codecs/video_decoder_factory_template_dav1d_adapter.h" @@ -171,6 +171,7 @@ absl::optional ParseRtpGeneratorOptionsFromFile( RtpGenerator::RtpGenerator(const RtpGeneratorOptions& options) : options_(options), + env_(CreateEnvironment()), video_encoder_factory_( std::make_unique>()), video_bitrate_allocator_factory_( CreateBuiltinVideoBitrateAllocatorFactory()), - event_log_(std::make_unique()), - call_(Call::Create(CallConfig(event_log_.get()))), - task_queue_(CreateDefaultTaskQueueFactory()) { + call_(Call::Create(CallConfig(env_))) { constexpr int kMinBitrateBps = 30000; // 30 Kbps constexpr int kMaxBitrateBps = 2500000; // 2.5 Mbps @@ -246,11 +245,11 @@ RtpGenerator::RtpGenerator(const RtpGeneratorOptions& options) // Setup the fake video stream for this. std::unique_ptr frame_generator = std::make_unique( - Clock::GetRealTimeClock(), + &env_.clock(), test::CreateSquareFrameGenerator(send_config.video_width, send_config.video_height, absl::nullopt, absl::nullopt), - send_config.video_fps, *task_queue_); + send_config.video_fps, env_.task_queue_factory()); frame_generator->Init(); VideoSendStream* video_send_stream = call_->CreateVideoSendStream( diff --git a/third_party/libwebrtc/rtc_tools/rtp_generator/rtp_generator.h b/third_party/libwebrtc/rtc_tools/rtp_generator/rtp_generator.h index e9d23362ef..2f178d3466 100644 --- a/third_party/libwebrtc/rtc_tools/rtp_generator/rtp_generator.h +++ b/third_party/libwebrtc/rtc_tools/rtp_generator/rtp_generator.h @@ -16,9 +16,8 @@ #include #include "api/call/transport.h" +#include "api/environment/environment.h" #include "api/media_types.h" -#include "api/rtc_event_log/rtc_event_log.h" -#include "api/task_queue/task_queue_factory.h" #include "api/video/builtin_video_bitrate_allocator_factory.h" #include "api/video_codecs/video_decoder_factory.h" #include "api/video_codecs/video_encoder_factory.h" @@ -104,18 +103,17 @@ class RtpGenerator final : public webrtc::Transport { test::RtpPacket DataToRtpPacket(const uint8_t* packet, size_t packet_len); const RtpGeneratorOptions options_; + const Environment env_; std::unique_ptr video_encoder_factory_; std::unique_ptr video_decoder_factory_; std::unique_ptr video_bitrate_allocator_factory_; - std::unique_ptr event_log_; std::unique_ptr call_; std::unique_ptr rtp_dump_writer_; std::vector> frame_generators_; std::vector video_send_streams_; std::vector durations_ms_; uint32_t start_ms_ = 0; - std::unique_ptr task_queue_; }; } // namespace webrtc diff --git a/third_party/libwebrtc/rtc_tools/unpack_aecdump/unpack.cc b/third_party/libwebrtc/rtc_tools/unpack_aecdump/unpack.cc index a43fe75b36..e8bb587cfa 100644 --- a/third_party/libwebrtc/rtc_tools/unpack_aecdump/unpack.cc +++ b/third_party/libwebrtc/rtc_tools/unpack_aecdump/unpack.cc @@ -29,13 +29,11 @@ #include "common_audio/wav_file.h" #include "modules/audio_processing/test/protobuf_utils.h" #include "rtc_base/checks.h" -#include "rtc_base/ignore_wundef.h" #include "rtc_base/strings/string_builder.h" #include "rtc_base/system/arch.h" -RTC_PUSH_IGNORING_WUNDEF() +// Generated at build-time by the protobuf compiler. #include "modules/audio_processing/debug.pb.h" -RTC_POP_IGNORING_WUNDEF() ABSL_FLAG(std::string, input_file, diff --git a/third_party/libwebrtc/rtc_tools/video_file_reader.h b/third_party/libwebrtc/rtc_tools/video_file_reader.h index 1293beba2f..270955b5f5 100644 --- a/third_party/libwebrtc/rtc_tools/video_file_reader.h +++ b/third_party/libwebrtc/rtc_tools/video_file_reader.h @@ -16,16 +16,16 @@ #include #include +#include "api/ref_count.h" #include "api/scoped_refptr.h" #include "api/video/video_frame_buffer.h" -#include "rtc_base/ref_count.h" namespace webrtc { namespace test { // Iterable class representing a sequence of I420 buffers. This class is not // thread safe because it is expected to be backed by a file. -class Video : public rtc::RefCountInterface { +class Video : public RefCountInterface { public: class Iterator { public: diff --git a/third_party/libwebrtc/rtc_tools/video_replay.cc b/third_party/libwebrtc/rtc_tools/video_replay.cc index b19850ed57..52c8d68048 100644 --- a/third_party/libwebrtc/rtc_tools/video_replay.cc +++ b/third_party/libwebrtc/rtc_tools/video_replay.cc @@ -16,10 +16,10 @@ #include "absl/flags/flag.h" #include "absl/flags/parse.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/task_queue/default_task_queue_factory.h" #include "api/test/video/function_video_decoder_factory.h" #include "api/transport/field_trial_based_config.h" #include "api/units/timestamp.h" @@ -36,7 +36,6 @@ #include "rtc_base/checks.h" #include "rtc_base/string_to_number.h" #include "rtc_base/strings/json.h" -#include "rtc_base/time_utils.h" #include "system_wrappers/include/clock.h" #include "system_wrappers/include/sleep.h" #include "test/call_config_utils.h" @@ -478,26 +477,21 @@ class RtpReplayer final { bool simulated_time) : replay_config_path_(replay_config_path), rtp_dump_path_(rtp_dump_path), - field_trials_(std::move(field_trials)), + time_sim_(simulated_time + ? std::make_unique( + Timestamp::Millis(1 << 30)) + : nullptr), + env_(CreateEnvironment( + std::move(field_trials), + time_sim_ ? time_sim_->GetTaskQueueFactory() : nullptr, + time_sim_ ? time_sim_->GetClock() : nullptr)), rtp_reader_(CreateRtpReader(rtp_dump_path_)) { - TaskQueueFactory* task_queue_factory; - if (simulated_time) { - time_sim_ = std::make_unique( - Timestamp::Millis(1 << 30)); - task_queue_factory = time_sim_->GetTaskQueueFactory(); - } else { - task_queue_factory_ = CreateDefaultTaskQueueFactory(field_trials_.get()), - task_queue_factory = task_queue_factory_.get(); - } - worker_thread_ = - std::make_unique(task_queue_factory->CreateTaskQueue( + worker_thread_ = std::make_unique( + env_.task_queue_factory().CreateTaskQueue( "worker_thread", TaskQueueFactory::Priority::NORMAL)); rtc::Event event; worker_thread_->PostTask([&]() { - CallConfig call_config(&event_log_); - call_config.trials = field_trials_.get(); - call_config.task_queue_factory = task_queue_factory; - call_ = Call::Create(call_config); + call_ = Call::Create(CallConfig(env_)); // Creation of the streams must happen inside a task queue because it is // resued as a worker thread. @@ -655,10 +649,7 @@ class RtpReplayer final { } } - int64_t CurrentTimeMs() { - return time_sim_ ? time_sim_->GetClock()->TimeInMilliseconds() - : rtc::TimeMillis(); - } + int64_t CurrentTimeMs() { return env_.clock().CurrentTime().ms(); } void SleepOrAdvanceTime(int64_t duration_ms) { if (time_sim_) { @@ -670,10 +661,8 @@ class RtpReplayer final { const std::string replay_config_path_; const std::string rtp_dump_path_; - RtcEventLogNull event_log_; - std::unique_ptr field_trials_; std::unique_ptr time_sim_; - std::unique_ptr task_queue_factory_; + Environment env_; std::unique_ptr worker_thread_; std::unique_ptr call_; std::unique_ptr rtp_reader_; -- cgit v1.2.3