Reland "Replace usage of link_capacity_kbps with DataRate link_capacity"

This reverts commit ff2dd50fd88e07affc4b070ce535935409f6673a.

Reason for revert: Temporary fix for downstream breakage in patch 2

Original change's description:
> Revert "Replace usage of link_capacity_kbps with DataRate link_capacity"
>
> This reverts commit 6186c0226e41dabbfc5cc8527e6b350b62f39f02.
>
> Reason for revert: Breaks downstream project.
>
> Original change's description:
> > 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}
>
> Bug: webrtc:14525
> Change-Id: I09ede3e89d065061cb4133bff96dbf242ff70832
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/350621
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Owners-Override: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#42309}

Bug: webrtc:14525
Change-Id: Ie35cd97a158d008a80ed007b27d2c6b1a9affff9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/350541
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42320}
This commit is contained in:
Per K 2024-05-15 15:53:02 +00:00 committed by WebRTC LUCI CQ
parent c6c6971d97
commit 5566b91356
21 changed files with 163 additions and 125 deletions

View File

@ -556,6 +556,7 @@ if (rtc_include_tests) {
"../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",

View File

@ -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 @@ void CallPerfTest::TestMinAudioVideoBitrate(int test_bitrate_from,
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 @@ void CallPerfTest::TestMinAudioVideoBitrate(int test_bitrate_from,
: 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);

View File

@ -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 @@ class FakeNetworkPipeTest : public ::testing::Test {
}
}
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 @@ class FakeNetworkPipeTest : public ::testing::Test {
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 @@ TEST_F(FakeNetworkPipeTest, CapacityTest) {
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 @@ TEST_F(FakeNetworkPipeTest, ExtraDelayTest) {
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 @@ TEST_F(FakeNetworkPipeTest, ExtraDelayTest) {
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, ExtraDelayTest) {
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 @@ TEST_F(FakeNetworkPipeTest, StatisticsTest) {
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, StatisticsTest) {
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 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithEmptyPipeTest) {
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 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithEmptyPipeTest) {
}
// 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 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithEmptyPipeTest) {
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, ChangingCapacityWithEmptyPipeTest) {
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 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithPacketsInPipeTest) {
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 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithPacketsInPipeTest) {
}
// 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, ChangingCapacityWithPacketsInPipeTest) {
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, BurstLoss) {
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);

View File

@ -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 @@ RampUpDownUpTester::RampUpDownUpTester(size_t num_video_streams,
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 @@ void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) {
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;

View File

@ -235,6 +235,7 @@ if (rtc_include_tests) {
"../../../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",

View File

@ -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::AllOf;
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, CanSendLargeMessage) {
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 @@ TEST_F(DcSctpSocketNetworkTest,
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_);

View File

@ -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 @@ TEST(GoogCcPeerScenarioTest, MAYBE_NoBweChangeFromVideoUnmute) {
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);

View File

@ -134,6 +134,7 @@ rtc_library("cross_traffic_unittest") {
"../..//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",

View File

@ -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 @@ TEST(TcpMessageRouteTest, DeliveredOnLossyNetwork) {
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;

View File

@ -63,7 +63,8 @@ void FeedbackGeneratorImpl::SetReturnConfig(
}
void FeedbackGeneratorImpl::SetSendLinkCapacity(DataRate capacity) {
conf_.send_link.link_capacity_kbps = capacity.kbps<int>();
conf_.send_link.link_capacity = capacity;
conf_.send_link.link_capacity_kbps = capacity.kbps_or(0);
send_link_->SetConfig(conf_.send_link);
}

View File

@ -52,7 +52,8 @@ TEST(SimulatedNetworkTest, EnqueueFirstPacketOnNetworkWithInfiniteCapacity) {
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 @@ TEST(SimulatedNetworkTest,
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,
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 @@ TEST(SimulatedNetworkTest, PacketOverhead) {
// 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 @@ TEST(SimulatedNetworkTest,
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 @@ TEST(SimulatedNetworkTest,
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 @@ TEST(SimulatedNetworkTest,
// 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 @@ TEST(SimulatedNetworkTest,
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 @@ TEST(SimulatedNetworkTest,
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 @@ TEST(SimulatedNetworkTest, SetConfigUpdateQueueDelayAfterDelivery) {
// 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 @@ TEST(SimulatedNetworkTest, SetConfigUpdateQueueDelayAfterDelivery) {
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, SetConfigUpdateQueueDelayAfterDelivery) {
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, NetworkEmptyAfterLastPacketDequeued) {
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 @@ TEST(SimulatedNetworkTest,
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,
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 @@ TEST(SimulatedNetworkTest,
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 @@ TEST(SimulatedNetworkTest, QueueDelayMsWithStandardDeviationAndReorderAllowed) {
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, PacketLoss) {
}
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 @@ TEST(SimulatedNetworkTest, PauseTransmissionUntil) {
// 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, PauseTransmissionUntil) {
}
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 @@ TEST(SimulatedNetworkTest, EnqueuePacketWithSubSecondNonMonotonicBehaviour) {
// 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 @@ TEST(SimulatedNetworkTest, EnqueuePacketWithSubSecondNonMonotonicBehaviour) {
// 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(

View File

@ -92,11 +92,13 @@ TEST(StatsBasedNetworkQualityMetricsReporterTest, DebugStatsAreCollected) {
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 =

View File

@ -24,7 +24,7 @@ constexpr char kDummyTransportName[] = "dummy";
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();

View File

@ -598,6 +598,7 @@ if (rtc_include_tests) {
"../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 @@ if (rtc_include_tests) {
"../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 @@ if (rtc_include_tests) {
"../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 @@ if (rtc_include_tests) {
"../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",

View File

@ -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 @@ class RtcpXrObserver : public test::EndToEndTest {
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 @@ class RtcpXrObserver : public test::EndToEndTest {
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_);
}

View File

@ -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 @@ TEST(FullStackTest, Foreman_Cif_Link_150kbps_Net_Delay_0_0_Plr_0) {
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 @@ TEST(FullStackTest,
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 @@ TEST(FullStackTest, Foreman_Cif_Link_250kbps_Delay100ms_10pkts_Loss1) {
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 @@ TEST(FullStackTest, Foreman_Cif_500kbps_Delay_50_0_Plr_3_Flexfec) {
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 @@ TEST(FullStackTest, Foreman_Cif_500kbps_Delay_50_0_Plr_3_Ulpfec) {
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 @@ TEST(FullStackTest, Foreman_Cif_500kbps) {
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 @@ TEST(FullStackTest, Foreman_Cif_500kbps_32pkts_Queue) {
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 @@ TEST(FullStackTest, Foreman_Cif_500kbps_100ms) {
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 @@ TEST(GenericDescriptorTest,
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 @@ TEST(FullStackTest, Foreman_Cif_500kbps_100ms_32pkts_Queue_Recv_Bwe) {
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 @@ TEST(FullStackTest, Foreman_Cif_1000kbps_100ms_32pkts_Queue) {
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 @@ TEST(FullStackTest, Conference_Motion_Hd_2000kbps_100ms_32pkts_Queue) {
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 @@ TEST(GenericDescriptorTest,
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 @@ TEST(FullStackTest, Conference_Motion_Hd_3tl_Moderate_Limits) {
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 @@ TEST(FullStackTest, Conference_Motion_Hd_4tl_Moderate_Limits) {
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 @@ TEST(FullStackTest, Foreman_Cif_30kbps_AV1) {
.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 @@ TEST(FullStackTest, Conference_Motion_Hd_3tl_AV1) {
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 @@ TEST(FullStackTest, Conference_Motion_Hd_2000kbps_100ms_32pkts_Queue_Vp9) {
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 @@ TEST(GenericDescriptorTest, Screenshare_Slides_Lossy_Net_Generic_Descriptor) {
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 @@ TEST(FullStackTest, Screenshare_Slides_Very_Lossy) {
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 @@ TEST(FullStackTest, Screenshare_Slides_Lossy_Limited) {
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 @@ TEST(FullStackTest, Screenshare_Slides_Moderately_Restricted) {
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 @@ TEST(FullStackTest, Vp9ksvc_3sl_Low_Bw_Limited) {
"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 @@ TEST(FullStackTest, Vp9ksvc_3sl_Medium_Network_Restricted) {
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 @@ TEST(FullStackTest, Vp9ksvc_3sl_Medium_Network_Restricted_Trusted_Rate) {
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);
}

View File

@ -289,7 +289,7 @@ TEST(PCFullStackTest, Pc_Foreman_Cif_Link_150kbps_Net_Delay_0_0_Plr_0) {
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 @@ TEST(PCFullStackTest, Pc_Foreman_Cif_Link_130kbps_Delay100ms_Loss1_Ulpfec) {
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 @@ TEST(PCFullStackTest, Pc_Foreman_Cif_Link_50kbps_Delay100ms_Loss1_Ulpfec) {
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 @@ TEST(PCFullStackTest,
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 @@ TEST(PCFullStackTest, Pc_Foreman_Cif_Link_250kbps_Delay100ms_10pkts_Loss1) {
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 @@ TEST(PCFullStackTest, Pc_Foreman_Cif_500kbps_Delay_50_0_Plr_3_Flexfec) {
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 @@ TEST(PCFullStackTest, Pc_Foreman_Cif_500kbps_Delay_50_0_Plr_3_Ulpfec) {
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 @@ TEST(PCFullStackTest, Pc_Foreman_Cif_500kbps) {
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 @@ TEST_P(ParameterizedPCFullStackTest, Pc_Foreman_Cif_500kbps_32pkts_Queue) {
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 @@ TEST(PCFullStackTest, Pc_Foreman_Cif_500kbps_100ms) {
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 @@ TEST(PCGenericDescriptorTest,
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 @@ TEST(PCFullStackTest, ForemanCif500kbps100msLimitedQueueRecvBwe) {
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 @@ TEST(PCFullStackTest, Pc_Foreman_Cif_1000kbps_100ms_32pkts_Queue) {
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 @@ TEST(PCFullStackTest, Pc_Conference_Motion_Hd_2000kbps_100ms_32pkts_Queue) {
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 @@ TEST(PCGenericDescriptorTest, ConferenceMotionHd2TLModerateLimits) {
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 @@ TEST(PCFullStackTest, ConferenceMotionHd3TLModerateLimits) {
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 @@ TEST(PCFullStackTest, ConferenceMotionHd4TLModerateLimits) {
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 @@ TEST_P(ParameterizedPCFullStackTest,
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 @@ TEST(PCGenericDescriptorTest, Screenshare_Slides_Lossy_Net_Generic_Descriptor) {
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 @@ TEST(PCFullStackTest, ScreenshareSlidesVP8_2TL_VeryLossyNet) {
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 @@ TEST(PCFullStackTest, ScreenshareSlidesVP8_2TL_LossyNetRestrictedQueue) {
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 @@ TEST(PCFullStackTest, ScreenshareSlidesVP8_2TL_ModeratelyRestricted) {
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 @@ TEST(PCFullStackTest, VP9KSVC_3SL_Medium_Network_Restricted) {
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 @@ TEST(PCFullStackTest, VP9KSVC_3SL_Medium_Network_Restricted_Trusted_Rate) {
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 @@ TEST_P(PCDualStreamsTest,
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 @@ TEST_P(PCDualStreamsTest, Conference_Restricted) {
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;

View File

@ -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 @@ std::vector<std::string> Slides() {
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();

View File

@ -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 @@ void Loopback() {
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();

View File

@ -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 @@ void Loopback() {
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();

View File

@ -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 @@ TEST_F(VideoSendStreamTest, PaddingIsPrimarilyRetransmissions) {
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;
}