mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
SimulatedNetworkNode::Builder use BuiltInNetworkBehaviorConfig.link_capacity
Bug: webrtc:14525 Change-Id: I0495e26244334a5bdb015912fbdaa7af7f2aefea Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/350280 Reviewed-by: Björn Terelius <terelius@webrtc.org> Commit-Queue: Per Kjellander <perkj@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42263}
This commit is contained in:
parent
f42d2b9ab5
commit
53d43d6a41
2 changed files with 20 additions and 2 deletions
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <utility>
|
||||
|
||||
#include "api/units/data_rate.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "test/network/simulated_network.h"
|
||||
|
||||
|
@ -55,17 +56,32 @@ NetworkEmulationManager::SimulatedNetworkNode::Builder::delay_ms(
|
|||
return *this;
|
||||
}
|
||||
|
||||
NetworkEmulationManager::SimulatedNetworkNode::Builder&
|
||||
NetworkEmulationManager::SimulatedNetworkNode::Builder::capacity(
|
||||
DataRate link_capacity) {
|
||||
config_.link_capacity = link_capacity;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NetworkEmulationManager::SimulatedNetworkNode::Builder&
|
||||
NetworkEmulationManager::SimulatedNetworkNode::Builder::capacity_kbps(
|
||||
int link_capacity_kbps) {
|
||||
config_.link_capacity_kbps = link_capacity_kbps;
|
||||
if (link_capacity_kbps > 0) {
|
||||
config_.link_capacity = DataRate::KilobitsPerSec(link_capacity_kbps);
|
||||
} else {
|
||||
config_.link_capacity = DataRate::Infinity();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
NetworkEmulationManager::SimulatedNetworkNode::Builder&
|
||||
NetworkEmulationManager::SimulatedNetworkNode::Builder::capacity_Mbps(
|
||||
int link_capacity_Mbps) {
|
||||
config_.link_capacity_kbps = link_capacity_Mbps * 1000;
|
||||
if (link_capacity_Mbps > 0) {
|
||||
config_.link_capacity = DataRate::KilobitsPerSec(link_capacity_Mbps * 1000);
|
||||
} else {
|
||||
config_.link_capacity = DataRate::Infinity();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "api/test/peer_network_dependencies.h"
|
||||
#include "api/test/simulated_network.h"
|
||||
#include "api/test/time_controller.h"
|
||||
#include "api/units/data_rate.h"
|
||||
#include "api/units/timestamp.h"
|
||||
#include "rtc_base/network.h"
|
||||
#include "rtc_base/network_constants.h"
|
||||
|
@ -200,6 +201,7 @@ class NetworkEmulationManager {
|
|||
// values.
|
||||
Builder& config(BuiltInNetworkBehaviorConfig config);
|
||||
Builder& delay_ms(int queue_delay_ms);
|
||||
Builder& capacity(DataRate link_capacity);
|
||||
Builder& capacity_kbps(int link_capacity_kbps);
|
||||
Builder& capacity_Mbps(int link_capacity_Mbps);
|
||||
Builder& loss(double loss_rate);
|
||||
|
|
Loading…
Reference in a new issue