Add setters to NetworkEmulationManager::SimulatedNetworkNode::Builder.

Bug: b/294494713
Change-Id: I89130a4742da5f04680aa38721afcd7f91fb30ad
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/314980
Auto-Submit: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40511}
This commit is contained in:
Mirko Bonadei 2023-08-04 09:00:24 +00:00 committed by WebRTC LUCI CQ
parent 9b82b2f8d6
commit cad3aed5fc
2 changed files with 31 additions and 0 deletions

View file

@ -82,6 +82,33 @@ NetworkEmulationManager::SimulatedNetworkNode::Builder::packet_queue_length(
return *this; 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
NetworkEmulationManager::SimulatedNetworkNode::Builder::Build( NetworkEmulationManager::SimulatedNetworkNode::Builder::Build(
uint64_t random_seed) const { uint64_t random_seed) const {

View file

@ -184,6 +184,10 @@ class NetworkEmulationManager {
Builder& capacity_Mbps(int link_capacity_Mbps); Builder& capacity_Mbps(int link_capacity_Mbps);
Builder& loss(double loss_rate); Builder& loss(double loss_rate);
Builder& packet_queue_length(int max_queue_length_in_packets); 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(uint64_t random_seed = 1) const;
SimulatedNetworkNode Build(NetworkEmulationManager* net, SimulatedNetworkNode Build(NetworkEmulationManager* net,
uint64_t random_seed = 1) const; uint64_t random_seed = 1) const;