Replace usage of link_capacity_kbps with DataRate link_capacity
Replace usage of BuiltInNetworkBehaviorConfig.link_capacity_kbps in tests with DataRate link_capacity.
Bug: webrtc:14525
Change-Id: Id1c1b8d20eb2be5e9d1461704bb7c37c61c491f0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/350300
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42306}
diff --git a/call/BUILD.gn b/call/BUILD.gn
index 8d5c3ef..112980f 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -556,6 +556,7 @@
"../api/task_queue:pending_task_safety_flag",
"../api/test/metrics:global_metrics_logger_and_exporter",
"../api/test/metrics:metric",
+ "../api/units:data_rate",
"../api/video:builtin_video_bitrate_allocator_factory",
"../api/video:video_bitrate_allocation",
"../api/video_codecs:video_codecs_api",
diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc
index e1d0d4c..15aaaa4 100644
--- a/call/call_perf_tests.cc
+++ b/call/call_perf_tests.cc
@@ -24,6 +24,7 @@
#include "api/test/metrics/global_metrics_logger_and_exporter.h"
#include "api/test/metrics/metric.h"
#include "api/test/simulated_network.h"
+#include "api/units/data_rate.h"
#include "api/video/builtin_video_bitrate_allocator_factory.h"
#include "api/video/video_bitrate_allocation.h"
#include "api/video_codecs/video_encoder.h"
@@ -958,7 +959,7 @@
protected:
BuiltInNetworkBehaviorConfig GetFakeNetworkPipeConfig() const {
BuiltInNetworkBehaviorConfig pipe_config;
- pipe_config.link_capacity_kbps = test_bitrate_from_;
+ pipe_config.link_capacity = DataRate::KilobitsPerSec(test_bitrate_from_);
return pipe_config;
}
@@ -990,7 +991,7 @@
: test_bitrate >= test_bitrate_to_;
test_bitrate += test_bitrate_step_) {
BuiltInNetworkBehaviorConfig pipe_config;
- pipe_config.link_capacity_kbps = test_bitrate;
+ pipe_config.link_capacity = DataRate::KilobitsPerSec(test_bitrate);
send_simulated_network_->SetConfig(pipe_config);
receive_simulated_network_->SetConfig(pipe_config);
diff --git a/call/fake_network_pipe_unittest.cc b/call/fake_network_pipe_unittest.cc
index 800d5a8..66e43f6 100644
--- a/call/fake_network_pipe_unittest.cc
+++ b/call/fake_network_pipe_unittest.cc
@@ -13,6 +13,7 @@
#include <memory>
#include <utility>
+#include "api/units/data_rate.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
@@ -75,8 +76,8 @@
}
}
- int PacketTimeMs(int capacity_kbps, int packet_size) const {
- return 8 * packet_size / capacity_kbps;
+ int PacketTimeMs(DataRate capacity, int packet_size) const {
+ return 8 * packet_size / capacity.kbps();
}
SimulatedClock fake_clock_;
@@ -86,7 +87,7 @@
TEST_F(FakeNetworkPipeTest, CapacityTest) {
BuiltInNetworkBehaviorConfig config;
config.queue_length_packets = 20;
- config.link_capacity_kbps = 80;
+ config.link_capacity = DataRate::KilobitsPerSec(80);
MockReceiver receiver;
auto simulated_network = std::make_unique<SimulatedNetwork>(config);
std::unique_ptr<FakeNetworkPipe> pipe(new FakeNetworkPipe(
@@ -99,8 +100,7 @@
SendPackets(pipe.get(), kNumPackets, kPacketSize);
// Time to get one packet through the link.
- const int kPacketTimeMs =
- PacketTimeMs(config.link_capacity_kbps, kPacketSize);
+ const int kPacketTimeMs = PacketTimeMs(config.link_capacity, kPacketSize);
// Time haven't increased yet, so we souldn't get any packets.
EXPECT_CALL(receiver, DeliverRtpPacket).Times(0);
@@ -127,7 +127,7 @@
BuiltInNetworkBehaviorConfig config;
config.queue_length_packets = 20;
config.queue_delay_ms = 100;
- config.link_capacity_kbps = 80;
+ config.link_capacity = DataRate::KilobitsPerSec(80);
MockReceiver receiver;
auto simulated_network = std::make_unique<SimulatedNetwork>(config);
std::unique_ptr<FakeNetworkPipe> pipe(new FakeNetworkPipe(
@@ -138,8 +138,7 @@
SendPackets(pipe.get(), kNumPackets, kPacketSize);
// Time to get one packet through the link.
- const int kPacketTimeMs =
- PacketTimeMs(config.link_capacity_kbps, kPacketSize);
+ const int kPacketTimeMs = PacketTimeMs(config.link_capacity, kPacketSize);
// Increase more than kPacketTimeMs, but not more than the extra delay.
fake_clock_.AdvanceTimeMilliseconds(kPacketTimeMs);
@@ -162,15 +161,14 @@
TEST_F(FakeNetworkPipeTest, QueueLengthTest) {
BuiltInNetworkBehaviorConfig config;
config.queue_length_packets = 2;
- config.link_capacity_kbps = 80;
+ config.link_capacity = DataRate::KilobitsPerSec(80);
MockReceiver receiver;
auto simulated_network = std::make_unique<SimulatedNetwork>(config);
std::unique_ptr<FakeNetworkPipe> pipe(new FakeNetworkPipe(
&fake_clock_, std::move(simulated_network), &receiver));
const int kPacketSize = 1000;
- const int kPacketTimeMs =
- PacketTimeMs(config.link_capacity_kbps, kPacketSize);
+ const int kPacketTimeMs = PacketTimeMs(config.link_capacity, kPacketSize);
// Send three packets and verify only 2 are delivered.
SendPackets(pipe.get(), 3, kPacketSize);
@@ -187,15 +185,14 @@
BuiltInNetworkBehaviorConfig config;
config.queue_length_packets = 2;
config.queue_delay_ms = 20;
- config.link_capacity_kbps = 80;
+ config.link_capacity = DataRate::KilobitsPerSec(80);
MockReceiver receiver;
auto simulated_network = std::make_unique<SimulatedNetwork>(config);
std::unique_ptr<FakeNetworkPipe> pipe(new FakeNetworkPipe(
&fake_clock_, std::move(simulated_network), &receiver));
const int kPacketSize = 1000;
- const int kPacketTimeMs =
- PacketTimeMs(config.link_capacity_kbps, kPacketSize);
+ const int kPacketTimeMs = PacketTimeMs(config.link_capacity, kPacketSize);
// Send three packets and verify only 2 are delivered.
SendPackets(pipe.get(), 3, kPacketSize);
@@ -218,7 +215,7 @@
TEST_F(FakeNetworkPipeTest, ChangingCapacityWithEmptyPipeTest) {
BuiltInNetworkBehaviorConfig config;
config.queue_length_packets = 20;
- config.link_capacity_kbps = 80;
+ config.link_capacity = DataRate::KilobitsPerSec(80);
MockReceiver receiver;
std::unique_ptr<SimulatedNetwork> network(new SimulatedNetwork(config));
SimulatedNetwork* simulated_network = network.get();
@@ -232,7 +229,7 @@
SendPackets(pipe.get(), kNumPackets, kPacketSize);
// Time to get one packet through the link.
- int packet_time_ms = PacketTimeMs(config.link_capacity_kbps, kPacketSize);
+ int packet_time_ms = PacketTimeMs(config.link_capacity, kPacketSize);
// Time hasn't increased yet, so we souldn't get any packets.
EXPECT_CALL(receiver, DeliverRtpPacket).Times(0);
@@ -246,7 +243,7 @@
}
// Change the capacity.
- config.link_capacity_kbps /= 2; // Reduce to 50%.
+ config.link_capacity = config.link_capacity / 2; // Reduce to 50%.
simulated_network->SetConfig(config);
// Add another 10 packets of 1000 bytes, = 80 kb, and verify it takes two
@@ -254,7 +251,7 @@
SendPackets(pipe.get(), kNumPackets, kPacketSize);
// Time to get one packet through the link.
- packet_time_ms = PacketTimeMs(config.link_capacity_kbps, kPacketSize);
+ packet_time_ms = PacketTimeMs(config.link_capacity, kPacketSize);
// Time hasn't increased yet, so we souldn't get any packets.
EXPECT_CALL(receiver, DeliverRtpPacket).Times(0);
@@ -280,7 +277,7 @@
TEST_F(FakeNetworkPipeTest, ChangingCapacityWithPacketsInPipeTest) {
BuiltInNetworkBehaviorConfig config;
config.queue_length_packets = 20;
- config.link_capacity_kbps = 80;
+ config.link_capacity = DataRate::KilobitsPerSec(80);
MockReceiver receiver;
std::unique_ptr<SimulatedNetwork> network(new SimulatedNetwork(config));
SimulatedNetwork* simulated_network = network.get();
@@ -297,7 +294,7 @@
pipe->Process();
// Advance time in steps to release half of the packets one at a time.
- int step_ms = PacketTimeMs(config.link_capacity_kbps, kPacketSize);
+ int step_ms = PacketTimeMs(config.link_capacity, kPacketSize);
for (int i = 0; i < kNumPackets / 2; ++i) {
fake_clock_.AdvanceTimeMilliseconds(step_ms);
EXPECT_CALL(receiver, DeliverRtpPacket).Times(1);
@@ -305,11 +302,11 @@
}
// Change the capacity.
- config.link_capacity_kbps *= 2; // Double the capacity.
+ config.link_capacity = 2 * config.link_capacity;
simulated_network->SetConfig(config);
// Advance time in steps to release remaining packets one at a time.
- step_ms = PacketTimeMs(config.link_capacity_kbps, kPacketSize);
+ step_ms = PacketTimeMs(config.link_capacity, kPacketSize);
for (int i = 0; i < kNumPackets / 2; ++i) {
fake_clock_.AdvanceTimeMilliseconds(step_ms);
EXPECT_CALL(receiver, DeliverRtpPacket).Times(1);
@@ -328,7 +325,7 @@
TEST_F(FakeNetworkPipeTest, DisallowReorderingThenAllowReordering) {
BuiltInNetworkBehaviorConfig config;
config.queue_length_packets = 1000;
- config.link_capacity_kbps = 800;
+ config.link_capacity = DataRate::KilobitsPerSec(80);
config.queue_delay_ms = 100;
config.delay_standard_deviation_ms = 10;
ReorderTestReceiver receiver;
@@ -415,15 +412,14 @@
TEST_F(FakeNetworkPipeTest, SetReceiver) {
BuiltInNetworkBehaviorConfig config;
- config.link_capacity_kbps = 800;
+ config.link_capacity = DataRate::KilobitsPerSec(800);
MockReceiver receiver;
auto simulated_network = std::make_unique<SimulatedNetwork>(config);
std::unique_ptr<FakeNetworkPipe> pipe(new FakeNetworkPipe(
&fake_clock_, std::move(simulated_network), &receiver));
const int kPacketSize = 1000;
- const int kPacketTimeMs =
- PacketTimeMs(config.link_capacity_kbps, kPacketSize);
+ const int kPacketTimeMs = PacketTimeMs(config.link_capacity, kPacketSize);
SendPackets(pipe.get(), 1, kPacketSize);
fake_clock_.AdvanceTimeMilliseconds(kPacketTimeMs);
EXPECT_CALL(receiver, DeliverRtpPacket).Times(1);
diff --git a/call/rampup_tests.cc b/call/rampup_tests.cc
index d93065f..103e998 100644
--- a/call/rampup_tests.cc
+++ b/call/rampup_tests.cc
@@ -19,6 +19,7 @@
#include "api/task_queue/task_queue_base.h"
#include "api/test/metrics/global_metrics_logger_and_exporter.h"
#include "api/test/metrics/metric.h"
+#include "api/units/data_rate.h"
#include "call/fake_network_pipe.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
@@ -410,7 +411,8 @@
interval_start_ms_(clock_->TimeInMilliseconds()),
sent_bytes_(0),
loss_rates_(loss_rates) {
- forward_transport_config_.link_capacity_kbps = link_rates_[test_state_];
+ forward_transport_config_.link_capacity =
+ DataRate::KilobitsPerSec(link_rates_[test_state_]);
forward_transport_config_.queue_delay_ms = 100;
forward_transport_config_.loss_percent = loss_rates_[test_state_];
}
@@ -549,7 +551,8 @@
case kTransitionToNextState:
if (!ExpectingFec() || GetFecBytes() > 0) {
test_state_ = next_state_;
- forward_transport_config_.link_capacity_kbps = link_rates_[test_state_];
+ forward_transport_config_.link_capacity =
+ DataRate::KilobitsPerSec(link_rates_[test_state_]);
// No loss while ramping up and down as it may affect the BWE
// negatively, making the test flaky.
forward_transport_config_.loss_percent = 0;
diff --git a/net/dcsctp/socket/BUILD.gn b/net/dcsctp/socket/BUILD.gn
index 7af8063..f002df1 100644
--- a/net/dcsctp/socket/BUILD.gn
+++ b/net/dcsctp/socket/BUILD.gn
@@ -235,6 +235,7 @@
"../../../api:network_emulation_manager_api",
"../../../api/task_queue",
"../../../api/task_queue:pending_task_safety_flag",
+ "../../../api/units:data_rate",
"../../../api/units:time_delta",
"../../../rtc_base:checks",
"../../../rtc_base:copy_on_write_buffer",
diff --git a/net/dcsctp/socket/dcsctp_socket_network_test.cc b/net/dcsctp/socket/dcsctp_socket_network_test.cc
index 801d471..0f41efb 100644
--- a/net/dcsctp/socket/dcsctp_socket_network_test.cc
+++ b/net/dcsctp/socket/dcsctp_socket_network_test.cc
@@ -22,6 +22,7 @@
#include "api/task_queue/task_queue_base.h"
#include "api/test/create_network_emulation_manager.h"
#include "api/test/network_emulation_manager.h"
+#include "api/units/data_rate.h"
#include "api/units/time_delta.h"
#include "net/dcsctp/public/dcsctp_options.h"
#include "net/dcsctp/public/dcsctp_socket.h"
@@ -54,6 +55,7 @@
using ::testing::Ge;
using ::testing::Le;
using ::testing::SizeIs;
+using ::webrtc::DataRate;
using ::webrtc::TimeDelta;
using ::webrtc::Timestamp;
@@ -406,7 +408,7 @@
TEST_F(DcSctpSocketNetworkTest, CanSendMessagesReliablyWithLowBandwidth) {
webrtc::BuiltInNetworkBehaviorConfig pipe_config;
pipe_config.queue_delay_ms = 30;
- pipe_config.link_capacity_kbps = 1000;
+ pipe_config.link_capacity = DataRate::KilobitsPerSec(1000);
MakeNetwork(pipe_config);
SctpActor sender("A", emulated_socket_a_, options_);
@@ -435,7 +437,7 @@
DCSCTP_NDEBUG_TEST(CanSendMessagesReliablyWithMediumBandwidth)) {
webrtc::BuiltInNetworkBehaviorConfig pipe_config;
pipe_config.queue_delay_ms = 30;
- pipe_config.link_capacity_kbps = 18000;
+ pipe_config.link_capacity = DataRate::KilobitsPerSec(18000);
MakeNetwork(pipe_config);
SctpActor sender("A", emulated_socket_a_, options_);
diff --git a/pc/scenario_tests/goog_cc_test.cc b/pc/scenario_tests/goog_cc_test.cc
index ea96408..ebe1047 100644
--- a/pc/scenario_tests/goog_cc_test.cc
+++ b/pc/scenario_tests/goog_cc_test.cc
@@ -10,6 +10,7 @@
#include "api/stats/rtc_stats_collector_callback.h"
#include "api/stats/rtcstats_objects.h"
+#include "api/units/data_rate.h"
#include "pc/test/mock_peer_connection_observers.h"
#include "test/field_trial.h"
#include "test/gtest.h"
@@ -42,7 +43,7 @@
auto* callee = s.CreateClient(PeerScenarioClient::Config());
BuiltInNetworkBehaviorConfig net_conf;
- net_conf.link_capacity_kbps = 350;
+ net_conf.link_capacity = DataRate::KilobitsPerSec(350);
net_conf.queue_delay_ms = 50;
auto send_node = s.net()->CreateEmulatedNode(net_conf);
auto ret_node = s.net()->CreateEmulatedNode(net_conf);
diff --git a/test/network/BUILD.gn b/test/network/BUILD.gn
index 94d57e1..aa22c47 100644
--- a/test/network/BUILD.gn
+++ b/test/network/BUILD.gn
@@ -134,6 +134,7 @@
"../..//test/network:simulated_network",
"../../api:network_emulation_manager_api",
"../../api:simulated_network_api",
+ "../../api/units:data_rate",
"../../rtc_base:logging",
"../../rtc_base:network_constants",
"../../rtc_base:rtc_event",
diff --git a/test/network/cross_traffic_unittest.cc b/test/network/cross_traffic_unittest.cc
index ff1c1e1..5382f66 100644
--- a/test/network/cross_traffic_unittest.cc
+++ b/test/network/cross_traffic_unittest.cc
@@ -19,6 +19,7 @@
#include "absl/types/optional.h"
#include "api/test/network_emulation_manager.h"
#include "api/test/simulated_network.h"
+#include "api/units/data_rate.h"
#include "rtc_base/event.h"
#include "rtc_base/logging.h"
#include "rtc_base/network_constants.h"
@@ -129,7 +130,7 @@
BuiltInNetworkBehaviorConfig send;
// 800 kbps means that the 100 kB message would be delivered in ca 1 second
// under ideal conditions and no overhead.
- send.link_capacity_kbps = 100 * 8;
+ send.link_capacity = DataRate::KilobitsPerSec(100 * 8);
send.loss_percent = 50;
send.queue_delay_ms = 100;
send.delay_standard_deviation_ms = 20;
diff --git a/test/network/feedback_generator.cc b/test/network/feedback_generator.cc
index 9df6e24..08da56a 100644
--- a/test/network/feedback_generator.cc
+++ b/test/network/feedback_generator.cc
@@ -63,7 +63,7 @@
}
void FeedbackGeneratorImpl::SetSendLinkCapacity(DataRate capacity) {
- conf_.send_link.link_capacity_kbps = capacity.kbps<int>();
+ conf_.send_link.link_capacity = capacity;
send_link_->SetConfig(conf_.send_link);
}
diff --git a/test/network/simulated_network_unittest.cc b/test/network/simulated_network_unittest.cc
index fa04e8a..536c1e2 100644
--- a/test/network/simulated_network_unittest.cc
+++ b/test/network/simulated_network_unittest.cc
@@ -52,7 +52,8 @@
TEST(SimulatedNetworkTest, EnqueueFirstPacketOnNetworkWithLimitedCapacity) {
// A packet of 125 bytes that gets enqueued on a network with 1 kbps capacity
// should be ready to exit the network in 1 second.
- SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1});
+ SimulatedNetwork network =
+ SimulatedNetwork({.link_capacity = DataRate::KilobitsPerSec(1)});
ASSERT_TRUE(network.EnqueuePacket(PacketWithSize(125)));
EXPECT_EQ(network.NextDeliveryTimeUs(), TimeDelta::Seconds(1).us());
@@ -62,7 +63,8 @@
EnqueuePacketsButNextDeliveryIsBasedOnFirstEnqueuedPacket) {
// A packet of 125 bytes that gets enqueued on a network with 1 kbps capacity
// should be ready to exit the network in 1 second.
- SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1});
+ SimulatedNetwork network =
+ SimulatedNetwork({.link_capacity = DataRate::KilobitsPerSec(1)});
ASSERT_TRUE(network.EnqueuePacket(
PacketInFlightInfo(/*size=*/125, /*send_time_us=*/0, /*packet_id=*/1)));
EXPECT_EQ(network.NextDeliveryTimeUs(), TimeDelta::Seconds(1).us());
@@ -83,7 +85,8 @@
TEST(SimulatedNetworkTest, EnqueueFailsWhenQueueLengthIsReached) {
SimulatedNetwork network =
- SimulatedNetwork({.queue_length_packets = 1, .link_capacity_kbps = 1});
+ SimulatedNetwork({.queue_length_packets = 1,
+ .link_capacity = DataRate::KilobitsPerSec(1)});
ASSERT_TRUE(network.EnqueuePacket(
PacketInFlightInfo(/*size=*/125, /*send_time_us=*/0, /*packet_id=*/1)));
@@ -110,8 +113,8 @@
// A packet of 125 bytes that gets enqueued on a network with 1 kbps capacity
// should be ready to exit the network in 1 second, but since there is an
// overhead per packet of 125 bytes, it will exit the network after 2 seconds.
- SimulatedNetwork network =
- SimulatedNetwork({.link_capacity_kbps = 1, .packet_overhead = 125});
+ SimulatedNetwork network = SimulatedNetwork(
+ {.link_capacity = DataRate::KilobitsPerSec(1), .packet_overhead = 125});
ASSERT_TRUE(network.EnqueuePacket(PacketWithSize(125)));
EXPECT_EQ(network.NextDeliveryTimeUs(), TimeDelta::Seconds(2).us());
@@ -121,7 +124,8 @@
DequeueDeliverablePacketsLeavesPacketsInCapacityLink) {
// A packet of 125 bytes that gets enqueued on a network with 1 kbps capacity
// should be ready to exit the network in 1 second.
- SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1});
+ SimulatedNetwork network =
+ SimulatedNetwork({.link_capacity = DataRate::KilobitsPerSec(1)});
ASSERT_TRUE(network.EnqueuePacket(
PacketInFlightInfo(/*size=*/125, /*send_time_us=*/0, /*packet_id=*/1)));
// Enqueue another packet of 125 bytes (this one should exit after 2 seconds).
@@ -151,7 +155,8 @@
DequeueDeliverablePacketsAppliesConfigChangesToCapacityLink) {
// A packet of 125 bytes that gets enqueued on a network with 1 kbps capacity
// should be ready to exit the network in 1 second.
- SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1});
+ SimulatedNetwork network =
+ SimulatedNetwork({.link_capacity = DataRate::KilobitsPerSec(1)});
const PacketInFlightInfo packet_1 =
PacketInFlightInfo(/*size=*/125, /*send_time_us=*/0, /*packet_id=*/1);
ASSERT_TRUE(network.EnqueuePacket(packet_1));
@@ -170,7 +175,7 @@
// Since the link capacity changes from 1 kbps to 10 kbps, packets will take
// 100 ms each to leave the network.
- network.SetConfig({.link_capacity_kbps = 10});
+ network.SetConfig({.link_capacity = DataRate::KilobitsPerSec(10)});
// The next delivery time doesn't change (it will be updated, if needed at
// DequeueDeliverablePackets time).
@@ -202,7 +207,8 @@
SetConfigUpdateNextDeliveryTimeIfLinkCapacityChange) {
// A packet of 125 bytes that gets enqueued on a network with 1 kbps capacity
// should be ready to exit the network in 1 second.
- SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1});
+ SimulatedNetwork network =
+ SimulatedNetwork({.link_capacity = DataRate::KilobitsPerSec(1)});
MockFunction<void()> delivery_time_changed_callback;
network.RegisterDeliveryTimeChangedCallback(
delivery_time_changed_callback.AsStdFunction());
@@ -217,7 +223,7 @@
EXPECT_CALL(delivery_time_changed_callback, Call).WillOnce([&]() {
EXPECT_EQ(network.NextDeliveryTimeUs(), TimeDelta::Millis(500 + 50).us());
});
- network.SetConfig({.link_capacity_kbps = 10},
+ network.SetConfig({.link_capacity = DataRate::KilobitsPerSec(10)},
/*config_update_time*/ Timestamp::Millis(500));
}
@@ -268,7 +274,8 @@
// A packet of 125 bytes that gets enqueued on a network with 1000 kbps
// capacity should be ready to exit the narrow section in 1 ms.
SimulatedNetwork network =
- SimulatedNetwork({.queue_delay_ms = 1000, .link_capacity_kbps = 1000});
+ SimulatedNetwork({.queue_delay_ms = 1000,
+ .link_capacity = DataRate::KilobitsPerSec(1000)});
MockFunction<void()> delivery_time_changed_callback;
network.RegisterDeliveryTimeChangedCallback(
delivery_time_changed_callback.AsStdFunction());
@@ -285,8 +292,9 @@
EXPECT_EQ(network.NextDeliveryTimeUs(), TimeDelta::Millis(1000 + 1).us());
// Changing the queue time does not change the next delivery time.
- network.SetConfig({.queue_delay_ms = 1, .link_capacity_kbps = 100},
- /*config_update_time*/ Timestamp::Millis(500));
+ network.SetConfig(
+ {.queue_delay_ms = 1, .link_capacity = DataRate::KilobitsPerSec(100)},
+ /*config_update_time*/ Timestamp::Millis(500));
EXPECT_EQ(network.NextDeliveryTimeUs(), TimeDelta::Millis(1000 + 1).us());
// A new packet require NextDeliveryTimeUs to change since the capacity
@@ -310,7 +318,8 @@
TEST(SimulatedNetworkTest, NetworkEmptyAfterLastPacketDequeued) {
// A packet of 125 bytes that gets enqueued on a network with 1 kbps
// capacity should be ready to exit the network in 1 second.
- SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1});
+ SimulatedNetwork network =
+ SimulatedNetwork({.link_capacity = DataRate::KilobitsPerSec(1)});
ASSERT_TRUE(network.EnqueuePacket(PacketWithSize(125)));
// Collecting all the delivered packets ...
@@ -326,7 +335,8 @@
TEST(SimulatedNetworkTest, DequeueDeliverablePacketsOnLateCall) {
// A packet of 125 bytes that gets enqueued on a network with 1 kbps
// capacity should be ready to exit the network in 1 second.
- SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1});
+ SimulatedNetwork network =
+ SimulatedNetwork({.link_capacity = DataRate::KilobitsPerSec(1)});
ASSERT_TRUE(network.EnqueuePacket(
PacketInFlightInfo(/*size=*/125, /*send_time_us=*/0, /*packet_id=*/1)));
@@ -349,7 +359,8 @@
DequeueDeliverablePacketsOnEarlyCallReturnsNoPackets) {
// A packet of 125 bytes that gets enqueued on a network with 1 kbps
// capacity should be ready to exit the network in 1 second.
- SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1});
+ SimulatedNetwork network =
+ SimulatedNetwork({.link_capacity = DataRate::KilobitsPerSec(1)});
ASSERT_TRUE(network.EnqueuePacket(PacketWithSize(125)));
// Collecting delivered packets after 0.5 seconds will result in the
@@ -366,8 +377,8 @@
TEST(SimulatedNetworkTest, QueueDelayMsWithoutStandardDeviation) {
// A packet of 125 bytes that gets enqueued on a network with 1 kbps
// capacity should be ready to exit the network in 1 second.
- SimulatedNetwork network =
- SimulatedNetwork({.queue_delay_ms = 100, .link_capacity_kbps = 1});
+ SimulatedNetwork network = SimulatedNetwork(
+ {.queue_delay_ms = 100, .link_capacity = DataRate::KilobitsPerSec(1)});
ASSERT_TRUE(network.EnqueuePacket(PacketWithSize(125)));
// The next delivery time is still 1 second even if there are 100 ms of
// extra delay but this will be applied at DequeueDeliverablePackets time.
@@ -394,7 +405,7 @@
SimulatedNetwork network =
SimulatedNetwork({.queue_delay_ms = 100,
.delay_standard_deviation_ms = 90,
- .link_capacity_kbps = 1,
+ .link_capacity = DataRate::KilobitsPerSec(1),
.allow_reordering = false});
// A packet of 125 bytes that gets enqueued on a network with 1 kbps
// capacity should be ready to exit the network in 1 second.
@@ -432,7 +443,7 @@
SimulatedNetwork network =
SimulatedNetwork({.queue_delay_ms = 100,
.delay_standard_deviation_ms = 90,
- .link_capacity_kbps = 1,
+ .link_capacity = DataRate::KilobitsPerSec(1),
.allow_reordering = true},
/*random_seed=*/1);
// A packet of 125 bytes that gets enqueued on a network with 1 kbps
@@ -494,10 +505,12 @@
}
TEST(SimulatedNetworkTest, NextDeliveryTimeSetAfterLostPackets) {
- // On a network with 50% probability of packet loss ...
- SimulatedNetwork network = SimulatedNetwork(
- {.queue_delay_ms = 10, .link_capacity_kbps = 1000, .loss_percent = 50},
- /*random_seed =*/1);
+ // On a network with 50% probablility of packet loss ...
+ SimulatedNetwork network =
+ SimulatedNetwork({.queue_delay_ms = 10,
+ .link_capacity = DataRate::KilobitsPerSec(1000),
+ .loss_percent = 50},
+ /*random_seed =*/1);
// Enqueueing 8 packets at the same time. It should take 1ms to pass through
// the capacity limited section per packet, it total adding 8ms delay to the
// last packet. Since queue delay is 10ms, multiple packets will be in the
@@ -569,7 +582,8 @@
// 3 packets of 125 bytes that gets enqueued on a network with 1 kbps
// capacity should be ready to exit the network after 1, 2 and 3 seconds
// respectively.
- SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1});
+ SimulatedNetwork network =
+ SimulatedNetwork({.link_capacity = DataRate::KilobitsPerSec(1)});
ASSERT_TRUE(network.EnqueuePacket(
PacketInFlightInfo(/*size=*/125, /*send_time_us=*/0, /*packet_id=*/1)));
ASSERT_TRUE(network.EnqueuePacket(
@@ -606,7 +620,8 @@
}
TEST(SimulatedNetworkTest, CongestedNetworkRespectsLinkCapacity) {
- SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1});
+ SimulatedNetwork network =
+ SimulatedNetwork({.link_capacity = DataRate::KilobitsPerSec(1)});
for (size_t i = 0; i < 1'000; ++i) {
ASSERT_TRUE(network.EnqueuePacket(PacketInFlightInfo(
/*size=*/125, /*send_time_us=*/0, /*packet_id=*/i)));
@@ -633,7 +648,8 @@
// non monothonic behaviour when running on different cores. This test
// checks that when a non monotonic packet enqueue, the network continues to
// work and the out of order packet is sent anyway.
- SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1});
+ SimulatedNetwork network =
+ SimulatedNetwork({.link_capacity = DataRate::KilobitsPerSec(1)});
ASSERT_TRUE(network.EnqueuePacket(PacketInFlightInfo(
/*size=*/125, /*send_time_us=*/TimeDelta::Seconds(1).us(),
/*packet_id=*/0)));
@@ -658,7 +674,8 @@
// TODO(bugs.webrtc.org/14525): Re-enable when the DCHECK will be uncommented
// and the non-monotonic events on real time clock tests is solved/understood.
// TEST(SimulatedNetworkDeathTest, EnqueuePacketExpectMonotonicSendTime) {
-// SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1});
+// SimulatedNetwork network = SimulatedNetwork({.link_capacity =
+// DataRate::KilobitsPerSec(1)});
// ASSERT_TRUE(network.EnqueuePacket(PacketInFlightInfo(
// /*size=*/125, /*send_time_us=*/2'000'000, /*packet_id=*/0)));
// EXPECT_DEATH_IF_SUPPORTED(network.EnqueuePacket(PacketInFlightInfo(
diff --git a/test/pc/e2e/stats_based_network_quality_metrics_reporter_test.cc b/test/pc/e2e/stats_based_network_quality_metrics_reporter_test.cc
index 6401902..a4ed112 100644
--- a/test/pc/e2e/stats_based_network_quality_metrics_reporter_test.cc
+++ b/test/pc/e2e/stats_based_network_quality_metrics_reporter_test.cc
@@ -92,11 +92,13 @@
EmulatedEndpoint* bob_endpoint =
network_emulation->CreateEndpoint(EmulatedEndpointConfig());
- EmulatedNetworkNode* alice_link = network_emulation->CreateEmulatedNode(
- BuiltInNetworkBehaviorConfig{.link_capacity_kbps = 500});
+ EmulatedNetworkNode* alice_link =
+ network_emulation->CreateEmulatedNode(BuiltInNetworkBehaviorConfig{
+ .link_capacity = DataRate::KilobitsPerSec(500)});
network_emulation->CreateRoute(alice_endpoint, {alice_link}, bob_endpoint);
- EmulatedNetworkNode* bob_link = network_emulation->CreateEmulatedNode(
- BuiltInNetworkBehaviorConfig{.link_capacity_kbps = 500});
+ EmulatedNetworkNode* bob_link =
+ network_emulation->CreateEmulatedNode(BuiltInNetworkBehaviorConfig{
+ .link_capacity = DataRate::KilobitsPerSec(500)});
network_emulation->CreateRoute(bob_endpoint, {bob_link}, alice_endpoint);
EmulatedNetworkManagerInterface* alice_network =
diff --git a/test/scenario/network_node.cc b/test/scenario/network_node.cc
index 6265454..edc573d 100644
--- a/test/scenario/network_node.cc
+++ b/test/scenario/network_node.cc
@@ -24,7 +24,7 @@
SimulatedNetwork::Config CreateSimulationConfig(
NetworkSimulationConfig config) {
SimulatedNetwork::Config sim_config;
- sim_config.link_capacity_kbps = config.bandwidth.kbps_or(0);
+ sim_config.link_capacity = config.bandwidth;
sim_config.loss_percent = config.loss_rate * 100;
sim_config.queue_delay_ms = config.delay.ms();
sim_config.delay_standard_deviation_ms = config.delay_std_dev.ms();
diff --git a/video/BUILD.gn b/video/BUILD.gn
index 3e423b6..0e2abe7 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -598,6 +598,7 @@
"../api:simulated_network_api",
"../api:test_dependency_factory",
"../api:video_quality_test_fixture_api",
+ "../api/units:data_rate",
"../api/video_codecs:video_codecs_api",
"../modules/pacing",
"../modules/video_coding:webrtc_vp9",
@@ -658,6 +659,7 @@
"../api:simulated_network_api",
"../api:video_quality_test_fixture_api",
"../api/transport:bitrate_settings",
+ "../api/units:data_rate",
"../api/video_codecs:video_codecs_api",
"../rtc_base:checks",
"../rtc_base:logging",
@@ -703,6 +705,7 @@
"../api:simulated_network_api",
"../api:video_quality_test_fixture_api",
"../api/transport:bitrate_settings",
+ "../api/units:data_rate",
"../api/video_codecs:video_codecs_api",
"../rtc_base:checks",
"../rtc_base:logging",
@@ -730,6 +733,7 @@
"../api:simulated_network_api",
"../api:video_quality_test_fixture_api",
"../api/transport:bitrate_settings",
+ "../api/units:data_rate",
"../api/video_codecs:video_codecs_api",
"../rtc_base:checks",
"../rtc_base:logging",
diff --git a/video/end_to_end_tests/extended_reports_tests.cc b/video/end_to_end_tests/extended_reports_tests.cc
index ae29b9c..21562da 100644
--- a/video/end_to_end_tests/extended_reports_tests.cc
+++ b/video/end_to_end_tests/extended_reports_tests.cc
@@ -20,6 +20,7 @@
#include "api/rtp_headers.h"
#include "api/task_queue/task_queue_base.h"
#include "api/test/simulated_network.h"
+#include "api/units/data_rate.h"
#include "api/video_codecs/sdp_video_format.h"
#include "call/call.h"
#include "call/fake_network_pipe.h"
@@ -76,7 +77,7 @@
sent_zero_rtcp_target_bitrate_(false),
sent_rtcp_dlrr_(0),
send_simulated_network_(nullptr) {
- forward_transport_config_.link_capacity_kbps = 500;
+ forward_transport_config_.link_capacity = DataRate::KilobitsPerSec(500);
forward_transport_config_.queue_delay_ms = 0;
forward_transport_config_.loss_percent = 0;
}
@@ -109,7 +110,7 @@
enable_zero_target_bitrate_) {
// Reduce bandwidth restriction to disable second stream after it was
// enabled for some time.
- forward_transport_config_.link_capacity_kbps = 200;
+ forward_transport_config_.link_capacity = DataRate::KilobitsPerSec(200);
send_simulated_network_->SetConfig(forward_transport_config_);
}
diff --git a/video/full_stack_tests.cc b/video/full_stack_tests.cc
index 892359f..b533c7b 100644
--- a/video/full_stack_tests.cc
+++ b/video/full_stack_tests.cc
@@ -18,6 +18,7 @@
#include "api/test/simulated_network.h"
#include "api/test/test_dependency_factory.h"
#include "api/test/video_quality_test_fixture.h"
+#include "api/units/data_rate.h"
#include "api/video_codecs/sdp_video_format.h"
#include "api/video_codecs/video_codec.h"
#include "api/video_codecs/vp9_profile.h"
@@ -215,7 +216,7 @@
false, false, true, ClipNameToClipPath("foreman_cif")};
foreman_cif.analyzer = {"foreman_cif_link_150kbps_net_delay_0_0_plr_0", 0.0,
0.0, kFullStackTestDurationSecs};
- foreman_cif.config->link_capacity_kbps = 150;
+ foreman_cif.config->link_capacity = DataRate::KilobitsPerSec(150);
fixture->RunWithAnalyzer(foreman_cif);
}
@@ -234,7 +235,7 @@
foreman_cif.analyzer = {
"foreman_cif_link_150kbps_delay100ms_30pkts_queue_overshoot30", 0.0, 0.0,
kFullStackTestDurationSecs};
- foreman_cif.config->link_capacity_kbps = 150;
+ foreman_cif.config->link_capacity = DataRate::KilobitsPerSec(150);
foreman_cif.config->queue_length_packets = 30;
foreman_cif.config->queue_delay_ms = 100;
fixture->RunWithAnalyzer(foreman_cif);
@@ -256,7 +257,7 @@
0, {}, 1.30};
foreman_cif.analyzer = {"foreman_cif_link_250kbps_delay100ms_10pkts_loss1",
0.0, 0.0, kFullStackTestDurationSecs};
- foreman_cif.config->link_capacity_kbps = 250;
+ foreman_cif.config->link_capacity = DataRate::KilobitsPerSec(250);
foreman_cif.config->queue_length_packets = 10;
foreman_cif.config->queue_delay_ms = 100;
foreman_cif.config->loss_percent = 1;
@@ -327,7 +328,7 @@
foreman_cif.analyzer = {"foreman_cif_500kbps_delay_50_0_plr_3_flexfec", 0.0,
0.0, kFullStackTestDurationSecs};
foreman_cif.config->loss_percent = 3;
- foreman_cif.config->link_capacity_kbps = 500;
+ foreman_cif.config->link_capacity = DataRate::KilobitsPerSec(500);
foreman_cif.config->queue_delay_ms = 50;
fixture->RunWithAnalyzer(foreman_cif);
}
@@ -344,7 +345,7 @@
foreman_cif.analyzer = {"foreman_cif_500kbps_delay_50_0_plr_3_ulpfec", 0.0,
0.0, kFullStackTestDurationSecs};
foreman_cif.config->loss_percent = 3;
- foreman_cif.config->link_capacity_kbps = 500;
+ foreman_cif.config->link_capacity = DataRate::KilobitsPerSec(500);
foreman_cif.config->queue_delay_ms = 50;
fixture->RunWithAnalyzer(foreman_cif);
}
@@ -466,7 +467,7 @@
kFullStackTestDurationSecs};
foreman_cif.config->queue_length_packets = 0;
foreman_cif.config->queue_delay_ms = 0;
- foreman_cif.config->link_capacity_kbps = 500;
+ foreman_cif.config->link_capacity = DataRate::KilobitsPerSec(500);
fixture->RunWithAnalyzer(foreman_cif);
}
@@ -483,7 +484,7 @@
kFullStackTestDurationSecs};
foreman_cif.config->queue_length_packets = 32;
foreman_cif.config->queue_delay_ms = 0;
- foreman_cif.config->link_capacity_kbps = 500;
+ foreman_cif.config->link_capacity = DataRate::KilobitsPerSec(500);
fixture->RunWithAnalyzer(foreman_cif);
}
@@ -500,7 +501,7 @@
kFullStackTestDurationSecs};
foreman_cif.config->queue_length_packets = 0;
foreman_cif.config->queue_delay_ms = 100;
- foreman_cif.config->link_capacity_kbps = 500;
+ foreman_cif.config->link_capacity = DataRate::KilobitsPerSec(500);
fixture->RunWithAnalyzer(foreman_cif);
}
@@ -519,7 +520,7 @@
kFullStackTestDurationSecs};
foreman_cif.config->queue_length_packets = 32;
foreman_cif.config->queue_delay_ms = 100;
- foreman_cif.config->link_capacity_kbps = 500;
+ foreman_cif.config->link_capacity = DataRate::KilobitsPerSec(500);
foreman_cif.call.generic_descriptor = true;
fixture->RunWithAnalyzer(foreman_cif);
}
@@ -537,7 +538,7 @@
0.0, 0.0, kFullStackTestDurationSecs};
foreman_cif.config->queue_length_packets = 32;
foreman_cif.config->queue_delay_ms = 100;
- foreman_cif.config->link_capacity_kbps = 500;
+ foreman_cif.config->link_capacity = DataRate::KilobitsPerSec(500);
fixture->RunWithAnalyzer(foreman_cif);
}
@@ -554,7 +555,7 @@
kFullStackTestDurationSecs};
foreman_cif.config->queue_length_packets = 32;
foreman_cif.config->queue_delay_ms = 100;
- foreman_cif.config->link_capacity_kbps = 1000;
+ foreman_cif.config->link_capacity = DataRate::KilobitsPerSec(1000);
fixture->RunWithAnalyzer(foreman_cif);
}
@@ -576,7 +577,7 @@
0.0, 0.0, kFullStackTestDurationSecs};
conf_motion_hd.config->queue_length_packets = 32;
conf_motion_hd.config->queue_delay_ms = 100;
- conf_motion_hd.config->link_capacity_kbps = 2000;
+ conf_motion_hd.config->link_capacity = DataRate::KilobitsPerSec(2000);
fixture->RunWithAnalyzer(conf_motion_hd);
}
@@ -600,7 +601,7 @@
conf_motion_hd.config->queue_length_packets = 50;
conf_motion_hd.config->loss_percent = 3;
conf_motion_hd.config->queue_delay_ms = 100;
- conf_motion_hd.config->link_capacity_kbps = 2000;
+ conf_motion_hd.config->link_capacity = DataRate::KilobitsPerSec(2000);
conf_motion_hd.call.generic_descriptor = true;
fixture->RunWithAnalyzer(conf_motion_hd);
}
@@ -623,7 +624,7 @@
conf_motion_hd.config->queue_length_packets = 50;
conf_motion_hd.config->loss_percent = 3;
conf_motion_hd.config->queue_delay_ms = 100;
- conf_motion_hd.config->link_capacity_kbps = 2000;
+ conf_motion_hd.config->link_capacity = DataRate::KilobitsPerSec(2000);
fixture->RunWithAnalyzer(conf_motion_hd);
}
@@ -645,7 +646,7 @@
conf_motion_hd.config->queue_length_packets = 50;
conf_motion_hd.config->loss_percent = 3;
conf_motion_hd.config->queue_delay_ms = 100;
- conf_motion_hd.config->link_capacity_kbps = 2000;
+ conf_motion_hd.config->link_capacity = DataRate::KilobitsPerSec(2000);
fixture->RunWithAnalyzer(conf_motion_hd);
}
@@ -666,7 +667,7 @@
.clip_path = ClipNameToClipPath("foreman_cif")};
foreman_cif.analyzer = {.test_label = "foreman_cif_30kbps_AV1",
.test_durations_secs = kFullStackTestDurationSecs};
- foreman_cif.config->link_capacity_kbps = 30;
+ foreman_cif.config->link_capacity = DataRate::KilobitsPerSec(30);
foreman_cif.call.generic_descriptor = true;
fixture->RunWithAnalyzer(foreman_cif);
}
@@ -692,7 +693,7 @@
conf_motion_hd.config->queue_length_packets = 50;
conf_motion_hd.config->loss_percent = 3;
conf_motion_hd.config->queue_delay_ms = 100;
- conf_motion_hd.config->link_capacity_kbps = 1000;
+ conf_motion_hd.config->link_capacity = DataRate::KilobitsPerSec(1000);
conf_motion_hd.call.generic_descriptor = true;
fixture->RunWithAnalyzer(conf_motion_hd);
}
@@ -716,7 +717,7 @@
kFullStackTestDurationSecs};
conf_motion_hd.config->queue_length_packets = 32;
conf_motion_hd.config->queue_delay_ms = 100;
- conf_motion_hd.config->link_capacity_kbps = 2000;
+ conf_motion_hd.config->link_capacity = DataRate::KilobitsPerSec(2000);
fixture->RunWithAnalyzer(conf_motion_hd);
}
#endif
@@ -791,7 +792,7 @@
0.0, 0.0, kFullStackTestDurationSecs};
screenshare.config->loss_percent = 5;
screenshare.config->queue_delay_ms = 200;
- screenshare.config->link_capacity_kbps = 500;
+ screenshare.config->link_capacity = DataRate::KilobitsPerSec(500);
screenshare.call.generic_descriptor = true;
fixture->RunWithAnalyzer(screenshare);
}
@@ -808,7 +809,7 @@
kFullStackTestDurationSecs};
screenshare.config->loss_percent = 10;
screenshare.config->queue_delay_ms = 200;
- screenshare.config->link_capacity_kbps = 500;
+ screenshare.config->link_capacity = DataRate::KilobitsPerSec(500);
fixture->RunWithAnalyzer(screenshare);
}
@@ -823,7 +824,7 @@
screenshare.analyzer = {"screenshare_slides_lossy_limited", 0.0, 0.0,
kFullStackTestDurationSecs};
screenshare.config->loss_percent = 5;
- screenshare.config->link_capacity_kbps = 200;
+ screenshare.config->link_capacity = DataRate::KilobitsPerSec(200);
screenshare.config->queue_length_packets = 30;
fixture->RunWithAnalyzer(screenshare);
@@ -840,7 +841,7 @@
screenshare.analyzer = {"screenshare_slides_moderately_restricted", 0.0, 0.0,
kFullStackTestDurationSecs};
screenshare.config->loss_percent = 1;
- screenshare.config->link_capacity_kbps = 1200;
+ screenshare.config->link_capacity = DataRate::KilobitsPerSec(1200);
screenshare.config->queue_length_packets = 30;
fixture->RunWithAnalyzer(screenshare);
@@ -953,7 +954,7 @@
"WebRTC-Vp9ExternalRefCtrl/Enabled/"));
auto fixture = CreateVideoQualityTestFixture();
ParamsWithLogging simulcast;
- simulcast.config->link_capacity_kbps = 500;
+ simulcast.config->link_capacity = DataRate::KilobitsPerSec(500);
simulcast.call.send_side_bwe = true;
simulcast.video[0] = SvcVp9Video();
simulcast.analyzer = {"vp9ksvc_3sl_low_bw_limited", 0.0, 0.0,
@@ -976,7 +977,7 @@
simulcast.ss[0] = {
std::vector<VideoStream>(), 0, 3, -1, InterLayerPredMode::kOnKeyPic,
std::vector<SpatialLayer>(), false};
- simulcast.config->link_capacity_kbps = 1000;
+ simulcast.config->link_capacity = DataRate::KilobitsPerSec(1000);
simulcast.config->queue_delay_ms = 100;
fixture->RunWithAnalyzer(simulcast);
}
@@ -994,7 +995,7 @@
simulcast.ss[0] = {
std::vector<VideoStream>(), 0, 3, -1, InterLayerPredMode::kOnKeyPic,
std::vector<SpatialLayer>(), false};
- simulcast.config->link_capacity_kbps = 1000;
+ simulcast.config->link_capacity = DataRate::KilobitsPerSec(1000);
simulcast.config->queue_delay_ms = 100;
fixture->RunWithAnalyzer(simulcast);
}
diff --git a/video/pc_full_stack_tests.cc b/video/pc_full_stack_tests.cc
index 000316b..f1d6494 100644
--- a/video/pc_full_stack_tests.cc
+++ b/video/pc_full_stack_tests.cc
@@ -289,7 +289,7 @@
std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
CreateNetworkEmulationManager();
BuiltInNetworkBehaviorConfig config;
- config.link_capacity_kbps = 150;
+ config.link_capacity = DataRate::KilobitsPerSec(150);
auto fixture = CreateTestFixture(
"pc_foreman_cif_link_150kbps_net_delay_0_0_plr_0",
*network_emulation_manager->time_controller(),
@@ -309,7 +309,7 @@
std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
CreateNetworkEmulationManager();
BuiltInNetworkBehaviorConfig config;
- config.link_capacity_kbps = 130;
+ config.link_capacity = DataRate::KilobitsPerSec(130);
config.queue_delay_ms = 100;
config.loss_percent = 1;
auto fixture = CreateTestFixture(
@@ -332,7 +332,7 @@
std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
CreateNetworkEmulationManager();
BuiltInNetworkBehaviorConfig config;
- config.link_capacity_kbps = 50;
+ config.link_capacity = DataRate::KilobitsPerSec(50);
config.queue_delay_ms = 100;
config.loss_percent = 1;
auto fixture = CreateTestFixture(
@@ -357,7 +357,7 @@
std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
CreateNetworkEmulationManager();
BuiltInNetworkBehaviorConfig config;
- config.link_capacity_kbps = 150;
+ config.link_capacity = DataRate::KilobitsPerSec(150);
config.queue_length_packets = 30;
config.queue_delay_ms = 100;
auto fixture = CreateTestFixture(
@@ -384,7 +384,7 @@
std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
CreateNetworkEmulationManager();
BuiltInNetworkBehaviorConfig config;
- config.link_capacity_kbps = 250;
+ config.link_capacity = DataRate::KilobitsPerSec(250);
config.queue_length_packets = 10;
config.queue_delay_ms = 100;
config.loss_percent = 1;
@@ -478,7 +478,7 @@
CreateNetworkEmulationManager();
BuiltInNetworkBehaviorConfig config;
config.loss_percent = 3;
- config.link_capacity_kbps = 500;
+ config.link_capacity = DataRate::KilobitsPerSec(500);
config.queue_delay_ms = 50;
auto fixture = CreateTestFixture(
"pc_foreman_cif_500kbps_delay_50_0_plr_3_flexfec",
@@ -503,7 +503,7 @@
CreateNetworkEmulationManager();
BuiltInNetworkBehaviorConfig config;
config.loss_percent = 3;
- config.link_capacity_kbps = 500;
+ config.link_capacity = DataRate::KilobitsPerSec(500);
config.queue_delay_ms = 50;
auto fixture = CreateTestFixture(
"pc_foreman_cif_500kbps_delay_50_0_plr_3_ulpfec",
@@ -687,7 +687,7 @@
BuiltInNetworkBehaviorConfig config;
config.queue_length_packets = 0;
config.queue_delay_ms = 0;
- config.link_capacity_kbps = 500;
+ config.link_capacity = DataRate::KilobitsPerSec(500);
auto fixture = CreateTestFixture(
"pc_foreman_cif_500kbps", *network_emulation_manager->time_controller(),
network_emulation_manager->CreateEndpointPairWithTwoWayRoutes(config),
@@ -708,7 +708,7 @@
BuiltInNetworkBehaviorConfig config;
config.queue_length_packets = 32;
config.queue_delay_ms = 0;
- config.link_capacity_kbps = 500;
+ config.link_capacity = DataRate::KilobitsPerSec(500);
auto fixture = CreateTestFixture(
"pc_foreman_cif_500kbps_32pkts_queue" + GetParam().test_case_name_postfix,
*network_emulation_manager->time_controller(),
@@ -737,7 +737,7 @@
BuiltInNetworkBehaviorConfig config;
config.queue_length_packets = 0;
config.queue_delay_ms = 100;
- config.link_capacity_kbps = 500;
+ config.link_capacity = DataRate::KilobitsPerSec(500);
auto fixture = CreateTestFixture(
"pc_foreman_cif_500kbps_100ms",
*network_emulation_manager->time_controller(),
@@ -760,7 +760,7 @@
BuiltInNetworkBehaviorConfig config;
config.queue_length_packets = 32;
config.queue_delay_ms = 100;
- config.link_capacity_kbps = 500;
+ config.link_capacity = DataRate::KilobitsPerSec(500);
auto fixture = CreateTestFixture(
"pc_foreman_cif_500kbps_100ms_32pkts_queue_generic_descriptor",
*network_emulation_manager->time_controller(),
@@ -792,7 +792,7 @@
0.0, 0.0, kTestDurationSec};
foreman_cif.config->queue_length_packets = 32;
foreman_cif.config->queue_delay_ms = 100;
- foreman_cif.config->link_capacity_kbps = 500;
+ foreman_cif.config->link_capacity = DataRate::KilobitsPerSec(500);
fixture->RunWithAnalyzer(foreman_cif);
}
*/
@@ -803,7 +803,7 @@
BuiltInNetworkBehaviorConfig config;
config.queue_length_packets = 32;
config.queue_delay_ms = 100;
- config.link_capacity_kbps = 1000;
+ config.link_capacity = DataRate::KilobitsPerSec(1000);
auto fixture = CreateTestFixture(
"pc_foreman_cif_1000kbps_100ms_32pkts_queue",
*network_emulation_manager->time_controller(),
@@ -826,7 +826,7 @@
BuiltInNetworkBehaviorConfig config;
config.queue_length_packets = 32;
config.queue_delay_ms = 100;
- config.link_capacity_kbps = 2000;
+ config.link_capacity = DataRate::KilobitsPerSec(2000);
auto fixture = CreateTestFixture(
"pc_conference_motion_hd_2000kbps_100ms_32pkts_queue",
*network_emulation_manager->time_controller(),
@@ -863,7 +863,7 @@
conf_motion_hd.config->queue_length_packets = 50;
conf_motion_hd.config->loss_percent = 3;
conf_motion_hd.config->queue_delay_ms = 100;
- conf_motion_hd.config->link_capacity_kbps = 2000;
+ conf_motion_hd.config->link_capacity = DataRate::KilobitsPerSec(2000);
conf_motion_hd.call.generic_descriptor = GenericDescriptorEnabled();
fixture->RunWithAnalyzer(conf_motion_hd);
}
@@ -887,7 +887,7 @@
conf_motion_hd.config->queue_length_packets = 50;
conf_motion_hd.config->loss_percent = 3;
conf_motion_hd.config->queue_delay_ms = 100;
- conf_motion_hd.config->link_capacity_kbps = 2000;
+ conf_motion_hd.config->link_capacity = DataRate::KilobitsPerSec(2000);
fixture->RunWithAnalyzer(conf_motion_hd);
}
@@ -910,7 +910,7 @@
conf_motion_hd.config->queue_length_packets = 50;
conf_motion_hd.config->loss_percent = 3;
conf_motion_hd.config->queue_delay_ms = 100;
- conf_motion_hd.config->link_capacity_kbps = 2000;
+ conf_motion_hd.config->link_capacity = DataRate::KilobitsPerSec(2000);
fixture->RunWithAnalyzer(conf_motion_hd);
}
@@ -924,7 +924,7 @@
BuiltInNetworkBehaviorConfig config;
config.queue_length_packets = 32;
config.queue_delay_ms = 100;
- config.link_capacity_kbps = 2000;
+ config.link_capacity = DataRate::KilobitsPerSec(2000);
auto fixture = CreateTestFixture(
"pc_conference_motion_hd_2000kbps_100ms_32pkts_queue_vp9" +
GetParam().test_case_name_postfix,
@@ -1119,7 +1119,7 @@
0.0, 0.0, kTestDurationSec};
screenshare.config->loss_percent = 5;
screenshare.config->queue_delay_ms = 200;
- screenshare.config->link_capacity_kbps = 500;
+ screenshare.config->link_capacity = DataRate::KilobitsPerSec(500);
screenshare.call.generic_descriptor = true;
fixture->RunWithAnalyzer(screenshare);
}
@@ -1137,7 +1137,7 @@
kTestDurationSec};
screenshare.config->loss_percent = 10;
screenshare.config->queue_delay_ms = 200;
- screenshare.config->link_capacity_kbps = 500;
+ screenshare.config->link_capacity = DataRate::KilobitsPerSec(500);
fixture->RunWithAnalyzer(screenshare);
}
@@ -1153,7 +1153,7 @@
screenshare.analyzer = {"screenshare_slides_lossy_limited", 0.0, 0.0,
kTestDurationSec};
screenshare.config->loss_percent = 5;
- screenshare.config->link_capacity_kbps = 200;
+ screenshare.config->link_capacity = DataRate::KilobitsPerSec(200);
screenshare.config->queue_length_packets = 30;
fixture->RunWithAnalyzer(screenshare);
@@ -1171,7 +1171,7 @@
screenshare.analyzer = {"screenshare_slides_moderately_restricted", 0.0, 0.0,
kTestDurationSec};
screenshare.config->loss_percent = 1;
- screenshare.config->link_capacity_kbps = 1200;
+ screenshare.config->link_capacity = DataRate::KilobitsPerSec(1200);
screenshare.config->queue_length_packets = 30;
fixture->RunWithAnalyzer(screenshare);
@@ -1397,7 +1397,7 @@
simulcast.ss[0] = {
std::vector<VideoStream>(), 0, 3, -1, InterLayerPredMode::kOnKeyPic,
std::vector<SpatialLayer>(), false};
- simulcast.config->link_capacity_kbps = 1000;
+ simulcast.config->link_capacity = DataRate::KilobitsPerSec(1000);
simulcast.config->queue_delay_ms = 100;
fixture->RunWithAnalyzer(simulcast);
}
@@ -1416,7 +1416,7 @@
simulcast.ss[0] = {
std::vector<VideoStream>(), 0, 3, -1, InterLayerPredMode::kOnKeyPic,
std::vector<SpatialLayer>(), false};
- simulcast.config->link_capacity_kbps = 1000;
+ simulcast.config->link_capacity = DataRate::KilobitsPerSec(1000);
simulcast.config->queue_delay_ms = 100;
fixture->RunWithAnalyzer(simulcast);
}
@@ -1695,7 +1695,7 @@
std::to_string(first_stream);
dual_streams.analyzer = {test_label, 0.0, 0.0, kTestDurationSec};
dual_streams.config->loss_percent = 1;
- dual_streams.config->link_capacity_kbps = 7500;
+ dual_streams.config->link_capacity = DataRate::KilobitsPerSec(7500);
dual_streams.config->queue_length_packets = 30;
dual_streams.config->queue_delay_ms = 100;
@@ -1733,7 +1733,7 @@
std::to_string(first_stream);
dual_streams.analyzer = {test_label, 0.0, 0.0, kTestDurationSec};
dual_streams.config->loss_percent = 1;
- dual_streams.config->link_capacity_kbps = 5000;
+ dual_streams.config->link_capacity = DataRate::KilobitsPerSec(5000);
dual_streams.config->queue_length_packets = 30;
dual_streams.config->queue_delay_ms = 100;
diff --git a/video/screenshare_loopback.cc b/video/screenshare_loopback.cc
index 607a5d5..9cbe501 100644
--- a/video/screenshare_loopback.cc
+++ b/video/screenshare_loopback.cc
@@ -20,6 +20,7 @@
#include "api/test/simulated_network.h"
#include "api/test/video_quality_test_fixture.h"
#include "api/transport/bitrate_settings.h"
+#include "api/units/data_rate.h"
#include "api/video_codecs/video_codec.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
@@ -313,7 +314,8 @@
void Loopback() {
BuiltInNetworkBehaviorConfig pipe_config;
pipe_config.loss_percent = LossPercent();
- pipe_config.link_capacity_kbps = LinkCapacityKbps();
+ pipe_config.link_capacity =
+ webrtc::DataRate::KilobitsPerSec(LinkCapacityKbps());
pipe_config.queue_length_packets = QueueSize();
pipe_config.queue_delay_ms = AvgPropagationDelayMs();
pipe_config.delay_standard_deviation_ms = StdPropagationDelayMs();
diff --git a/video/sv_loopback.cc b/video/sv_loopback.cc
index b0a90a0..67b27e8 100644
--- a/video/sv_loopback.cc
+++ b/video/sv_loopback.cc
@@ -20,6 +20,7 @@
#include "api/test/simulated_network.h"
#include "api/test/video_quality_test_fixture.h"
#include "api/transport/bitrate_settings.h"
+#include "api/units/data_rate.h"
#include "api/video_codecs/video_codec.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
@@ -584,7 +585,7 @@
BuiltInNetworkBehaviorConfig pipe_config;
pipe_config.loss_percent = LossPercent();
pipe_config.avg_burst_loss_length = AvgBurstLossLength();
- pipe_config.link_capacity_kbps = LinkCapacityKbps();
+ pipe_config.link_capacity = DataRate::KilobitsPerSec(LinkCapacityKbps());
pipe_config.queue_length_packets = QueueSize();
pipe_config.queue_delay_ms = AvgPropagationDelayMs();
pipe_config.delay_standard_deviation_ms = StdPropagationDelayMs();
diff --git a/video/video_loopback.cc b/video/video_loopback.cc
index 50c6f2b..973ffe6 100644
--- a/video/video_loopback.cc
+++ b/video/video_loopback.cc
@@ -21,6 +21,7 @@
#include "api/test/simulated_network.h"
#include "api/test/video_quality_test_fixture.h"
#include "api/transport/bitrate_settings.h"
+#include "api/units/data_rate.h"
#include "api/video_codecs/video_codec.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
@@ -357,7 +358,7 @@
BuiltInNetworkBehaviorConfig pipe_config;
pipe_config.loss_percent = LossPercent();
pipe_config.avg_burst_loss_length = AvgBurstLossLength();
- pipe_config.link_capacity_kbps = LinkCapacityKbps();
+ pipe_config.link_capacity = DataRate::KilobitsPerSec(LinkCapacityKbps());
pipe_config.queue_length_packets = QueueSize();
pipe_config.queue_delay_ms = AvgPropagationDelayMs();
pipe_config.delay_standard_deviation_ms = StdPropagationDelayMs();
diff --git a/video/video_send_stream_tests.cc b/video/video_send_stream_tests.cc
index 21698ce..8237354 100644
--- a/video/video_send_stream_tests.cc
+++ b/video/video_send_stream_tests.cc
@@ -18,6 +18,7 @@
#include "api/test/metrics/global_metrics_logger_and_exporter.h"
#include "api/test/metrics/metric.h"
#include "api/test/simulated_network.h"
+#include "api/units/data_rate.h"
#include "api/units/time_delta.h"
#include "api/video/builtin_video_bitrate_allocator_factory.h"
#include "api/video/encoded_image.h"
@@ -1460,7 +1461,7 @@
const int kNetworkDelayMs = 50;
BuiltInNetworkBehaviorConfig config;
config.loss_percent = 10;
- config.link_capacity_kbps = kCapacityKbps;
+ config.link_capacity = DataRate::KilobitsPerSec(kCapacityKbps);
config.queue_delay_ms = kNetworkDelayMs;
return config;
}