diff options
Diffstat (limited to 'third_party/libwebrtc/test/network/network_emulation_manager.cc')
-rw-r--r-- | third_party/libwebrtc/test/network/network_emulation_manager.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/third_party/libwebrtc/test/network/network_emulation_manager.cc b/third_party/libwebrtc/test/network/network_emulation_manager.cc index 97c0bc1ba8..dd0e93d8ee 100644 --- a/third_party/libwebrtc/test/network/network_emulation_manager.cc +++ b/third_party/libwebrtc/test/network/network_emulation_manager.cc @@ -13,6 +13,7 @@ #include <algorithm> #include <memory> +#include "api/field_trials_view.h" #include "api/units/time_delta.h" #include "api/units/timestamp.h" #include "call/simulated_network.h" @@ -30,10 +31,12 @@ constexpr uint32_t kMinIPv4Address = 0xC0A80000; // uint32_t representation of 192.168.255.255 address constexpr uint32_t kMaxIPv4Address = 0xC0A8FFFF; -std::unique_ptr<TimeController> CreateTimeController(TimeMode mode) { +std::unique_ptr<TimeController> CreateTimeController( + TimeMode mode, + const FieldTrialsView* field_trials) { switch (mode) { case TimeMode::kRealTime: - return std::make_unique<RealTimeController>(); + return std::make_unique<RealTimeController>(field_trials); case TimeMode::kSimulated: // Using an offset of 100000 to get nice fixed width and readable // timestamps in typical test scenarios. @@ -46,10 +49,11 @@ std::unique_ptr<TimeController> CreateTimeController(TimeMode mode) { NetworkEmulationManagerImpl::NetworkEmulationManagerImpl( TimeMode mode, - EmulatedNetworkStatsGatheringMode stats_gathering_mode) + EmulatedNetworkStatsGatheringMode stats_gathering_mode, + const FieldTrialsView* field_trials) : time_mode_(mode), stats_gathering_mode_(stats_gathering_mode), - time_controller_(CreateTimeController(mode)), + time_controller_(CreateTimeController(mode, field_trials)), clock_(time_controller_->GetClock()), next_node_id_(1), next_ip4_address_(kMinIPv4Address), @@ -75,8 +79,9 @@ EmulatedNetworkNode* NetworkEmulationManagerImpl::CreateEmulatedNode( EmulatedNetworkNode* NetworkEmulationManagerImpl::CreateEmulatedNode( std::unique_ptr<NetworkBehaviorInterface> network_behavior) { - auto node = std::make_unique<EmulatedNetworkNode>( - clock_, &task_queue_, std::move(network_behavior), stats_gathering_mode_); + auto node = std::make_unique<EmulatedNetworkNode>(clock_, task_queue_.Get(), + std::move(network_behavior), + stats_gathering_mode_); EmulatedNetworkNode* out = node.get(); task_queue_.PostTask([this, node = std::move(node)]() mutable { network_nodes_.push_back(std::move(node)); @@ -111,7 +116,7 @@ EmulatedEndpointImpl* NetworkEmulationManagerImpl::CreateEndpoint( auto node = std::make_unique<EmulatedEndpointImpl>( EmulatedEndpointImpl::Options(next_node_id_++, *ip, config, stats_gathering_mode_), - config.start_as_enabled, &task_queue_, clock_); + config.start_as_enabled, task_queue_.Get(), clock_); EmulatedEndpointImpl* out = node.get(); endpoints_.push_back(std::move(node)); return out; |