From cad3aed5fc894f61b65d54b6fd05433acbfef546 Mon Sep 17 00:00:00 2001 From: Mirko Bonadei Date: Fri, 4 Aug 2023 09:00:24 +0000 Subject: [PATCH] Add setters to NetworkEmulationManager::SimulatedNetworkNode::Builder. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: b/294494713 Change-Id: I89130a4742da5f04680aa38721afcd7f91fb30ad Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/314980 Auto-Submit: Mirko Bonadei Reviewed-by: Björn Terelius Commit-Queue: Björn Terelius Cr-Commit-Position: refs/heads/main@{#40511} --- api/test/network_emulation_manager.cc | 27 +++++++++++++++++++++++++++ api/test/network_emulation_manager.h | 4 ++++ 2 files changed, 31 insertions(+) diff --git a/api/test/network_emulation_manager.cc b/api/test/network_emulation_manager.cc index 236e2f0e17..756fe4e757 100644 --- a/api/test/network_emulation_manager.cc +++ b/api/test/network_emulation_manager.cc @@ -82,6 +82,33 @@ NetworkEmulationManager::SimulatedNetworkNode::Builder::packet_queue_length( return *this; } +NetworkEmulationManager::SimulatedNetworkNode::Builder& +NetworkEmulationManager::SimulatedNetworkNode::Builder:: + delay_standard_deviation_ms(int delay_standard_deviation_ms) { + config_.delay_standard_deviation_ms = delay_standard_deviation_ms; + return *this; +} + +NetworkEmulationManager::SimulatedNetworkNode::Builder& +NetworkEmulationManager::SimulatedNetworkNode::Builder::allow_reordering() { + config_.allow_reordering = true; + return *this; +} + +NetworkEmulationManager::SimulatedNetworkNode::Builder& +NetworkEmulationManager::SimulatedNetworkNode::Builder::avg_burst_loss_length( + int avg_burst_loss_length) { + config_.avg_burst_loss_length = avg_burst_loss_length; + return *this; +} + +NetworkEmulationManager::SimulatedNetworkNode::Builder& +NetworkEmulationManager::SimulatedNetworkNode::Builder::packet_overhead( + int packet_overhead) { + config_.packet_overhead = packet_overhead; + return *this; +} + NetworkEmulationManager::SimulatedNetworkNode NetworkEmulationManager::SimulatedNetworkNode::Builder::Build( uint64_t random_seed) const { diff --git a/api/test/network_emulation_manager.h b/api/test/network_emulation_manager.h index bc9279d306..6b66d8188a 100644 --- a/api/test/network_emulation_manager.h +++ b/api/test/network_emulation_manager.h @@ -184,6 +184,10 @@ class NetworkEmulationManager { Builder& capacity_Mbps(int link_capacity_Mbps); Builder& loss(double loss_rate); Builder& packet_queue_length(int max_queue_length_in_packets); + Builder& delay_standard_deviation_ms(int delay_standard_deviation_ms); + Builder& allow_reordering(); + Builder& avg_burst_loss_length(int avg_burst_loss_length); + Builder& packet_overhead(int packet_overhead); SimulatedNetworkNode Build(uint64_t random_seed = 1) const; SimulatedNetworkNode Build(NetworkEmulationManager* net, uint64_t random_seed = 1) const;