From ff2dd50fd88e07affc4b070ce535935409f6673a Mon Sep 17 00:00:00 2001 From: Mirko Bonadei Date: Wed, 15 May 2024 11:08:33 +0000 Subject: [PATCH] Revert "Replace usage of link_capacity_kbps with DataRate link_capacity" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 > Reviewed-by: Harald Alvestrand > Commit-Queue: Per Kjellander > Reviewed-by: Björn Terelius > 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 Bot-Commit: rubber-stamper@appspot.gserviceaccount.com Owners-Override: Mirko Bonadei Cr-Commit-Position: refs/heads/main@{#42309} --- call/BUILD.gn | 1 - call/call_perf_tests.cc | 5 +- call/fake_network_pipe_unittest.cc | 48 ++++++------ call/rampup_tests.cc | 7 +- net/dcsctp/socket/BUILD.gn | 1 - .../socket/dcsctp_socket_network_test.cc | 6 +- pc/scenario_tests/goog_cc_test.cc | 3 +- test/network/BUILD.gn | 1 - test/network/cross_traffic_unittest.cc | 3 +- test/network/feedback_generator.cc | 2 +- test/network/simulated_network_unittest.cc | 73 +++++++------------ ...d_network_quality_metrics_reporter_test.cc | 10 +-- test/scenario/network_node.cc | 2 +- video/BUILD.gn | 4 - .../extended_reports_tests.cc | 5 +- video/full_stack_tests.cc | 51 +++++++------ video/pc_full_stack_tests.cc | 52 ++++++------- video/screenshare_loopback.cc | 4 +- video/sv_loopback.cc | 3 +- video/video_loopback.cc | 3 +- video/video_send_stream_tests.cc | 3 +- 21 files changed, 125 insertions(+), 162 deletions(-) diff --git a/call/BUILD.gn b/call/BUILD.gn index 112980fc64..8d5c3ef05f 100644 --- a/call/BUILD.gn +++ b/call/BUILD.gn @@ -556,7 +556,6 @@ 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", diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc index 15aaaa44aa..e1d0d4c57e 100644 --- a/call/call_perf_tests.cc +++ b/call/call_perf_tests.cc @@ -24,7 +24,6 @@ #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" @@ -959,7 +958,7 @@ void CallPerfTest::TestMinAudioVideoBitrate(int test_bitrate_from, protected: BuiltInNetworkBehaviorConfig GetFakeNetworkPipeConfig() const { BuiltInNetworkBehaviorConfig pipe_config; - pipe_config.link_capacity = DataRate::KilobitsPerSec(test_bitrate_from_); + pipe_config.link_capacity_kbps = test_bitrate_from_; return pipe_config; } @@ -991,7 +990,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 = DataRate::KilobitsPerSec(test_bitrate); + pipe_config.link_capacity_kbps = 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 66e43f69b7..800d5a8cbe 100644 --- a/call/fake_network_pipe_unittest.cc +++ b/call/fake_network_pipe_unittest.cc @@ -13,7 +13,6 @@ #include #include -#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" @@ -76,8 +75,8 @@ class FakeNetworkPipeTest : public ::testing::Test { } } - int PacketTimeMs(DataRate capacity, int packet_size) const { - return 8 * packet_size / capacity.kbps(); + int PacketTimeMs(int capacity_kbps, int packet_size) const { + return 8 * packet_size / capacity_kbps; } SimulatedClock fake_clock_; @@ -87,7 +86,7 @@ class FakeNetworkPipeTest : public ::testing::Test { TEST_F(FakeNetworkPipeTest, CapacityTest) { BuiltInNetworkBehaviorConfig config; config.queue_length_packets = 20; - config.link_capacity = DataRate::KilobitsPerSec(80); + config.link_capacity_kbps = 80; MockReceiver receiver; auto simulated_network = std::make_unique(config); std::unique_ptr pipe(new FakeNetworkPipe( @@ -100,7 +99,8 @@ TEST_F(FakeNetworkPipeTest, CapacityTest) { SendPackets(pipe.get(), kNumPackets, kPacketSize); // Time to get one packet through the link. - const int kPacketTimeMs = PacketTimeMs(config.link_capacity, kPacketSize); + const int kPacketTimeMs = + PacketTimeMs(config.link_capacity_kbps, 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 = DataRate::KilobitsPerSec(80); + config.link_capacity_kbps = 80; MockReceiver receiver; auto simulated_network = std::make_unique(config); std::unique_ptr pipe(new FakeNetworkPipe( @@ -138,7 +138,8 @@ TEST_F(FakeNetworkPipeTest, ExtraDelayTest) { SendPackets(pipe.get(), kNumPackets, kPacketSize); // Time to get one packet through the link. - const int kPacketTimeMs = PacketTimeMs(config.link_capacity, kPacketSize); + const int kPacketTimeMs = + PacketTimeMs(config.link_capacity_kbps, kPacketSize); // Increase more than kPacketTimeMs, but not more than the extra delay. fake_clock_.AdvanceTimeMilliseconds(kPacketTimeMs); @@ -161,14 +162,15 @@ TEST_F(FakeNetworkPipeTest, ExtraDelayTest) { TEST_F(FakeNetworkPipeTest, QueueLengthTest) { BuiltInNetworkBehaviorConfig config; config.queue_length_packets = 2; - config.link_capacity = DataRate::KilobitsPerSec(80); + config.link_capacity_kbps = 80; MockReceiver receiver; auto simulated_network = std::make_unique(config); std::unique_ptr pipe(new FakeNetworkPipe( &fake_clock_, std::move(simulated_network), &receiver)); const int kPacketSize = 1000; - const int kPacketTimeMs = PacketTimeMs(config.link_capacity, kPacketSize); + const int kPacketTimeMs = + PacketTimeMs(config.link_capacity_kbps, kPacketSize); // Send three packets and verify only 2 are delivered. SendPackets(pipe.get(), 3, kPacketSize); @@ -185,14 +187,15 @@ TEST_F(FakeNetworkPipeTest, StatisticsTest) { BuiltInNetworkBehaviorConfig config; config.queue_length_packets = 2; config.queue_delay_ms = 20; - config.link_capacity = DataRate::KilobitsPerSec(80); + config.link_capacity_kbps = 80; MockReceiver receiver; auto simulated_network = std::make_unique(config); std::unique_ptr pipe(new FakeNetworkPipe( &fake_clock_, std::move(simulated_network), &receiver)); const int kPacketSize = 1000; - const int kPacketTimeMs = PacketTimeMs(config.link_capacity, kPacketSize); + const int kPacketTimeMs = + PacketTimeMs(config.link_capacity_kbps, kPacketSize); // Send three packets and verify only 2 are delivered. SendPackets(pipe.get(), 3, kPacketSize); @@ -215,7 +218,7 @@ TEST_F(FakeNetworkPipeTest, StatisticsTest) { TEST_F(FakeNetworkPipeTest, ChangingCapacityWithEmptyPipeTest) { BuiltInNetworkBehaviorConfig config; config.queue_length_packets = 20; - config.link_capacity = DataRate::KilobitsPerSec(80); + config.link_capacity_kbps = 80; MockReceiver receiver; std::unique_ptr network(new SimulatedNetwork(config)); SimulatedNetwork* simulated_network = network.get(); @@ -229,7 +232,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, kPacketSize); + int packet_time_ms = PacketTimeMs(config.link_capacity_kbps, kPacketSize); // Time hasn't increased yet, so we souldn't get any packets. EXPECT_CALL(receiver, DeliverRtpPacket).Times(0); @@ -243,7 +246,7 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithEmptyPipeTest) { } // Change the capacity. - config.link_capacity = config.link_capacity / 2; // Reduce to 50%. + config.link_capacity_kbps /= 2; // Reduce to 50%. simulated_network->SetConfig(config); // Add another 10 packets of 1000 bytes, = 80 kb, and verify it takes two @@ -251,7 +254,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, kPacketSize); + packet_time_ms = PacketTimeMs(config.link_capacity_kbps, kPacketSize); // Time hasn't increased yet, so we souldn't get any packets. EXPECT_CALL(receiver, DeliverRtpPacket).Times(0); @@ -277,7 +280,7 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithEmptyPipeTest) { TEST_F(FakeNetworkPipeTest, ChangingCapacityWithPacketsInPipeTest) { BuiltInNetworkBehaviorConfig config; config.queue_length_packets = 20; - config.link_capacity = DataRate::KilobitsPerSec(80); + config.link_capacity_kbps = 80; MockReceiver receiver; std::unique_ptr network(new SimulatedNetwork(config)); SimulatedNetwork* simulated_network = network.get(); @@ -294,7 +297,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, kPacketSize); + int step_ms = PacketTimeMs(config.link_capacity_kbps, kPacketSize); for (int i = 0; i < kNumPackets / 2; ++i) { fake_clock_.AdvanceTimeMilliseconds(step_ms); EXPECT_CALL(receiver, DeliverRtpPacket).Times(1); @@ -302,11 +305,11 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithPacketsInPipeTest) { } // Change the capacity. - config.link_capacity = 2 * config.link_capacity; + config.link_capacity_kbps *= 2; // Double the capacity. simulated_network->SetConfig(config); // Advance time in steps to release remaining packets one at a time. - step_ms = PacketTimeMs(config.link_capacity, kPacketSize); + step_ms = PacketTimeMs(config.link_capacity_kbps, kPacketSize); for (int i = 0; i < kNumPackets / 2; ++i) { fake_clock_.AdvanceTimeMilliseconds(step_ms); EXPECT_CALL(receiver, DeliverRtpPacket).Times(1); @@ -325,7 +328,7 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithPacketsInPipeTest) { TEST_F(FakeNetworkPipeTest, DisallowReorderingThenAllowReordering) { BuiltInNetworkBehaviorConfig config; config.queue_length_packets = 1000; - config.link_capacity = DataRate::KilobitsPerSec(80); + config.link_capacity_kbps = 800; config.queue_delay_ms = 100; config.delay_standard_deviation_ms = 10; ReorderTestReceiver receiver; @@ -412,14 +415,15 @@ TEST_F(FakeNetworkPipeTest, BurstLoss) { TEST_F(FakeNetworkPipeTest, SetReceiver) { BuiltInNetworkBehaviorConfig config; - config.link_capacity = DataRate::KilobitsPerSec(800); + config.link_capacity_kbps = 800; MockReceiver receiver; auto simulated_network = std::make_unique(config); std::unique_ptr pipe(new FakeNetworkPipe( &fake_clock_, std::move(simulated_network), &receiver)); const int kPacketSize = 1000; - const int kPacketTimeMs = PacketTimeMs(config.link_capacity, kPacketSize); + const int kPacketTimeMs = + PacketTimeMs(config.link_capacity_kbps, 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 103e998079..d93065fe12 100644 --- a/call/rampup_tests.cc +++ b/call/rampup_tests.cc @@ -19,7 +19,6 @@ #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" @@ -411,8 +410,7 @@ RampUpDownUpTester::RampUpDownUpTester(size_t num_video_streams, interval_start_ms_(clock_->TimeInMilliseconds()), sent_bytes_(0), loss_rates_(loss_rates) { - forward_transport_config_.link_capacity = - DataRate::KilobitsPerSec(link_rates_[test_state_]); + forward_transport_config_.link_capacity_kbps = link_rates_[test_state_]; forward_transport_config_.queue_delay_ms = 100; forward_transport_config_.loss_percent = loss_rates_[test_state_]; } @@ -551,8 +549,7 @@ void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) { case kTransitionToNextState: if (!ExpectingFec() || GetFecBytes() > 0) { test_state_ = next_state_; - forward_transport_config_.link_capacity = - DataRate::KilobitsPerSec(link_rates_[test_state_]); + forward_transport_config_.link_capacity_kbps = 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 f002df151b..7af8063e91 100644 --- a/net/dcsctp/socket/BUILD.gn +++ b/net/dcsctp/socket/BUILD.gn @@ -235,7 +235,6 @@ 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", diff --git a/net/dcsctp/socket/dcsctp_socket_network_test.cc b/net/dcsctp/socket/dcsctp_socket_network_test.cc index 0f41efbcff..801d471365 100644 --- a/net/dcsctp/socket/dcsctp_socket_network_test.cc +++ b/net/dcsctp/socket/dcsctp_socket_network_test.cc @@ -22,7 +22,6 @@ #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" @@ -55,7 +54,6 @@ using ::testing::AllOf; using ::testing::Ge; using ::testing::Le; using ::testing::SizeIs; -using ::webrtc::DataRate; using ::webrtc::TimeDelta; using ::webrtc::Timestamp; @@ -408,7 +406,7 @@ TEST_F(DcSctpSocketNetworkTest, CanSendLargeMessage) { TEST_F(DcSctpSocketNetworkTest, CanSendMessagesReliablyWithLowBandwidth) { webrtc::BuiltInNetworkBehaviorConfig pipe_config; pipe_config.queue_delay_ms = 30; - pipe_config.link_capacity = DataRate::KilobitsPerSec(1000); + pipe_config.link_capacity_kbps = 1000; MakeNetwork(pipe_config); SctpActor sender("A", emulated_socket_a_, options_); @@ -437,7 +435,7 @@ TEST_F(DcSctpSocketNetworkTest, DCSCTP_NDEBUG_TEST(CanSendMessagesReliablyWithMediumBandwidth)) { webrtc::BuiltInNetworkBehaviorConfig pipe_config; pipe_config.queue_delay_ms = 30; - pipe_config.link_capacity = DataRate::KilobitsPerSec(18000); + pipe_config.link_capacity_kbps = 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 ebe1047812..ea96408ac7 100644 --- a/pc/scenario_tests/goog_cc_test.cc +++ b/pc/scenario_tests/goog_cc_test.cc @@ -10,7 +10,6 @@ #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" @@ -43,7 +42,7 @@ TEST(GoogCcPeerScenarioTest, MAYBE_NoBweChangeFromVideoUnmute) { auto* callee = s.CreateClient(PeerScenarioClient::Config()); BuiltInNetworkBehaviorConfig net_conf; - net_conf.link_capacity = DataRate::KilobitsPerSec(350); + net_conf.link_capacity_kbps = 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 aa22c4758b..94d57e101c 100644 --- a/test/network/BUILD.gn +++ b/test/network/BUILD.gn @@ -134,7 +134,6 @@ 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", diff --git a/test/network/cross_traffic_unittest.cc b/test/network/cross_traffic_unittest.cc index 5382f66389..ff1c1e176e 100644 --- a/test/network/cross_traffic_unittest.cc +++ b/test/network/cross_traffic_unittest.cc @@ -19,7 +19,6 @@ #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" @@ -130,7 +129,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 = DataRate::KilobitsPerSec(100 * 8); + send.link_capacity_kbps = 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 08da56aac9..9df6e24a4c 100644 --- a/test/network/feedback_generator.cc +++ b/test/network/feedback_generator.cc @@ -63,7 +63,7 @@ void FeedbackGeneratorImpl::SetReturnConfig( } void FeedbackGeneratorImpl::SetSendLinkCapacity(DataRate capacity) { - conf_.send_link.link_capacity = capacity; + conf_.send_link.link_capacity_kbps = capacity.kbps(); send_link_->SetConfig(conf_.send_link); } diff --git a/test/network/simulated_network_unittest.cc b/test/network/simulated_network_unittest.cc index 536c1e227c..fa04e8a2da 100644 --- a/test/network/simulated_network_unittest.cc +++ b/test/network/simulated_network_unittest.cc @@ -52,8 +52,7 @@ 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 = DataRate::KilobitsPerSec(1)}); + SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1}); ASSERT_TRUE(network.EnqueuePacket(PacketWithSize(125))); EXPECT_EQ(network.NextDeliveryTimeUs(), TimeDelta::Seconds(1).us()); @@ -63,8 +62,7 @@ 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 = DataRate::KilobitsPerSec(1)}); + SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1}); ASSERT_TRUE(network.EnqueuePacket( PacketInFlightInfo(/*size=*/125, /*send_time_us=*/0, /*packet_id=*/1))); EXPECT_EQ(network.NextDeliveryTimeUs(), TimeDelta::Seconds(1).us()); @@ -85,8 +83,7 @@ TEST(SimulatedNetworkTest, TEST(SimulatedNetworkTest, EnqueueFailsWhenQueueLengthIsReached) { SimulatedNetwork network = - SimulatedNetwork({.queue_length_packets = 1, - .link_capacity = DataRate::KilobitsPerSec(1)}); + SimulatedNetwork({.queue_length_packets = 1, .link_capacity_kbps = 1}); ASSERT_TRUE(network.EnqueuePacket( PacketInFlightInfo(/*size=*/125, /*send_time_us=*/0, /*packet_id=*/1))); @@ -113,8 +110,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 = DataRate::KilobitsPerSec(1), .packet_overhead = 125}); + SimulatedNetwork network = + SimulatedNetwork({.link_capacity_kbps = 1, .packet_overhead = 125}); ASSERT_TRUE(network.EnqueuePacket(PacketWithSize(125))); EXPECT_EQ(network.NextDeliveryTimeUs(), TimeDelta::Seconds(2).us()); @@ -124,8 +121,7 @@ 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 = DataRate::KilobitsPerSec(1)}); + SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 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). @@ -155,8 +151,7 @@ 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 = DataRate::KilobitsPerSec(1)}); + SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1}); const PacketInFlightInfo packet_1 = PacketInFlightInfo(/*size=*/125, /*send_time_us=*/0, /*packet_id=*/1); ASSERT_TRUE(network.EnqueuePacket(packet_1)); @@ -175,7 +170,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 = DataRate::KilobitsPerSec(10)}); + network.SetConfig({.link_capacity_kbps = 10}); // The next delivery time doesn't change (it will be updated, if needed at // DequeueDeliverablePackets time). @@ -207,8 +202,7 @@ 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 = DataRate::KilobitsPerSec(1)}); + SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1}); MockFunction delivery_time_changed_callback; network.RegisterDeliveryTimeChangedCallback( delivery_time_changed_callback.AsStdFunction()); @@ -223,7 +217,7 @@ TEST(SimulatedNetworkTest, EXPECT_CALL(delivery_time_changed_callback, Call).WillOnce([&]() { EXPECT_EQ(network.NextDeliveryTimeUs(), TimeDelta::Millis(500 + 50).us()); }); - network.SetConfig({.link_capacity = DataRate::KilobitsPerSec(10)}, + network.SetConfig({.link_capacity_kbps = 10}, /*config_update_time*/ Timestamp::Millis(500)); } @@ -274,8 +268,7 @@ 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 = DataRate::KilobitsPerSec(1000)}); + SimulatedNetwork({.queue_delay_ms = 1000, .link_capacity_kbps = 1000}); MockFunction delivery_time_changed_callback; network.RegisterDeliveryTimeChangedCallback( delivery_time_changed_callback.AsStdFunction()); @@ -292,9 +285,8 @@ 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 = DataRate::KilobitsPerSec(100)}, - /*config_update_time*/ Timestamp::Millis(500)); + network.SetConfig({.queue_delay_ms = 1, .link_capacity_kbps = 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 @@ -318,8 +310,7 @@ 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 = DataRate::KilobitsPerSec(1)}); + SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1}); ASSERT_TRUE(network.EnqueuePacket(PacketWithSize(125))); // Collecting all the delivered packets ... @@ -335,8 +326,7 @@ 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 = DataRate::KilobitsPerSec(1)}); + SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1}); ASSERT_TRUE(network.EnqueuePacket( PacketInFlightInfo(/*size=*/125, /*send_time_us=*/0, /*packet_id=*/1))); @@ -359,8 +349,7 @@ 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 = DataRate::KilobitsPerSec(1)}); + SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1}); ASSERT_TRUE(network.EnqueuePacket(PacketWithSize(125))); // Collecting delivered packets after 0.5 seconds will result in the @@ -377,8 +366,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 = DataRate::KilobitsPerSec(1)}); + SimulatedNetwork network = + SimulatedNetwork({.queue_delay_ms = 100, .link_capacity_kbps = 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. @@ -405,7 +394,7 @@ TEST(SimulatedNetworkTest, SimulatedNetwork network = SimulatedNetwork({.queue_delay_ms = 100, .delay_standard_deviation_ms = 90, - .link_capacity = DataRate::KilobitsPerSec(1), + .link_capacity_kbps = 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. @@ -443,7 +432,7 @@ TEST(SimulatedNetworkTest, QueueDelayMsWithStandardDeviationAndReorderAllowed) { SimulatedNetwork network = SimulatedNetwork({.queue_delay_ms = 100, .delay_standard_deviation_ms = 90, - .link_capacity = DataRate::KilobitsPerSec(1), + .link_capacity_kbps = 1, .allow_reordering = true}, /*random_seed=*/1); // A packet of 125 bytes that gets enqueued on a network with 1 kbps @@ -505,12 +494,10 @@ TEST(SimulatedNetworkTest, PacketLoss) { } TEST(SimulatedNetworkTest, NextDeliveryTimeSetAfterLostPackets) { - // 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); + // 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); // 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 @@ -582,8 +569,7 @@ 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 = DataRate::KilobitsPerSec(1)}); + SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1}); ASSERT_TRUE(network.EnqueuePacket( PacketInFlightInfo(/*size=*/125, /*send_time_us=*/0, /*packet_id=*/1))); ASSERT_TRUE(network.EnqueuePacket( @@ -620,8 +606,7 @@ TEST(SimulatedNetworkTest, PauseTransmissionUntil) { } TEST(SimulatedNetworkTest, CongestedNetworkRespectsLinkCapacity) { - SimulatedNetwork network = - SimulatedNetwork({.link_capacity = DataRate::KilobitsPerSec(1)}); + SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1}); for (size_t i = 0; i < 1'000; ++i) { ASSERT_TRUE(network.EnqueuePacket(PacketInFlightInfo( /*size=*/125, /*send_time_us=*/0, /*packet_id=*/i))); @@ -648,8 +633,7 @@ 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 = DataRate::KilobitsPerSec(1)}); + SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 1}); ASSERT_TRUE(network.EnqueuePacket(PacketInFlightInfo( /*size=*/125, /*send_time_us=*/TimeDelta::Seconds(1).us(), /*packet_id=*/0))); @@ -674,8 +658,7 @@ 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 = -// DataRate::KilobitsPerSec(1)}); +// SimulatedNetwork network = SimulatedNetwork({.link_capacity_kbps = 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 a4ed112963..6401902fb3 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,13 +92,11 @@ TEST(StatsBasedNetworkQualityMetricsReporterTest, DebugStatsAreCollected) { EmulatedEndpoint* bob_endpoint = network_emulation->CreateEndpoint(EmulatedEndpointConfig()); - EmulatedNetworkNode* alice_link = - network_emulation->CreateEmulatedNode(BuiltInNetworkBehaviorConfig{ - .link_capacity = DataRate::KilobitsPerSec(500)}); + EmulatedNetworkNode* alice_link = network_emulation->CreateEmulatedNode( + BuiltInNetworkBehaviorConfig{.link_capacity_kbps = 500}); network_emulation->CreateRoute(alice_endpoint, {alice_link}, bob_endpoint); - EmulatedNetworkNode* bob_link = - network_emulation->CreateEmulatedNode(BuiltInNetworkBehaviorConfig{ - .link_capacity = DataRate::KilobitsPerSec(500)}); + EmulatedNetworkNode* bob_link = network_emulation->CreateEmulatedNode( + BuiltInNetworkBehaviorConfig{.link_capacity_kbps = 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 edc573d95f..6265454263 100644 --- a/test/scenario/network_node.cc +++ b/test/scenario/network_node.cc @@ -24,7 +24,7 @@ constexpr char kDummyTransportName[] = "dummy"; SimulatedNetwork::Config CreateSimulationConfig( NetworkSimulationConfig config) { SimulatedNetwork::Config sim_config; - sim_config.link_capacity = config.bandwidth; + sim_config.link_capacity_kbps = config.bandwidth.kbps_or(0); 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 0e2abe7693..3e423b61be 100644 --- a/video/BUILD.gn +++ b/video/BUILD.gn @@ -598,7 +598,6 @@ 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", @@ -659,7 +658,6 @@ 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", @@ -705,7 +703,6 @@ 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", @@ -733,7 +730,6 @@ 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", diff --git a/video/end_to_end_tests/extended_reports_tests.cc b/video/end_to_end_tests/extended_reports_tests.cc index 21562da3e8..ae29b9c836 100644 --- a/video/end_to_end_tests/extended_reports_tests.cc +++ b/video/end_to_end_tests/extended_reports_tests.cc @@ -20,7 +20,6 @@ #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" @@ -77,7 +76,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 = DataRate::KilobitsPerSec(500); + forward_transport_config_.link_capacity_kbps = 500; forward_transport_config_.queue_delay_ms = 0; forward_transport_config_.loss_percent = 0; } @@ -110,7 +109,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 = DataRate::KilobitsPerSec(200); + forward_transport_config_.link_capacity_kbps = 200; send_simulated_network_->SetConfig(forward_transport_config_); } diff --git a/video/full_stack_tests.cc b/video/full_stack_tests.cc index b533c7b608..892359fde0 100644 --- a/video/full_stack_tests.cc +++ b/video/full_stack_tests.cc @@ -18,7 +18,6 @@ #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" @@ -216,7 +215,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 = DataRate::KilobitsPerSec(150); + foreman_cif.config->link_capacity_kbps = 150; fixture->RunWithAnalyzer(foreman_cif); } @@ -235,7 +234,7 @@ TEST(FullStackTest, foreman_cif.analyzer = { "foreman_cif_link_150kbps_delay100ms_30pkts_queue_overshoot30", 0.0, 0.0, kFullStackTestDurationSecs}; - foreman_cif.config->link_capacity = DataRate::KilobitsPerSec(150); + foreman_cif.config->link_capacity_kbps = 150; foreman_cif.config->queue_length_packets = 30; foreman_cif.config->queue_delay_ms = 100; fixture->RunWithAnalyzer(foreman_cif); @@ -257,7 +256,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 = DataRate::KilobitsPerSec(250); + foreman_cif.config->link_capacity_kbps = 250; foreman_cif.config->queue_length_packets = 10; foreman_cif.config->queue_delay_ms = 100; foreman_cif.config->loss_percent = 1; @@ -328,7 +327,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 = DataRate::KilobitsPerSec(500); + foreman_cif.config->link_capacity_kbps = 500; foreman_cif.config->queue_delay_ms = 50; fixture->RunWithAnalyzer(foreman_cif); } @@ -345,7 +344,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 = DataRate::KilobitsPerSec(500); + foreman_cif.config->link_capacity_kbps = 500; foreman_cif.config->queue_delay_ms = 50; fixture->RunWithAnalyzer(foreman_cif); } @@ -467,7 +466,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 = DataRate::KilobitsPerSec(500); + foreman_cif.config->link_capacity_kbps = 500; fixture->RunWithAnalyzer(foreman_cif); } @@ -484,7 +483,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 = DataRate::KilobitsPerSec(500); + foreman_cif.config->link_capacity_kbps = 500; fixture->RunWithAnalyzer(foreman_cif); } @@ -501,7 +500,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 = DataRate::KilobitsPerSec(500); + foreman_cif.config->link_capacity_kbps = 500; fixture->RunWithAnalyzer(foreman_cif); } @@ -520,7 +519,7 @@ TEST(GenericDescriptorTest, kFullStackTestDurationSecs}; foreman_cif.config->queue_length_packets = 32; foreman_cif.config->queue_delay_ms = 100; - foreman_cif.config->link_capacity = DataRate::KilobitsPerSec(500); + foreman_cif.config->link_capacity_kbps = 500; foreman_cif.call.generic_descriptor = true; fixture->RunWithAnalyzer(foreman_cif); } @@ -538,7 +537,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 = DataRate::KilobitsPerSec(500); + foreman_cif.config->link_capacity_kbps = 500; fixture->RunWithAnalyzer(foreman_cif); } @@ -555,7 +554,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 = DataRate::KilobitsPerSec(1000); + foreman_cif.config->link_capacity_kbps = 1000; fixture->RunWithAnalyzer(foreman_cif); } @@ -577,7 +576,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 = DataRate::KilobitsPerSec(2000); + conf_motion_hd.config->link_capacity_kbps = 2000; fixture->RunWithAnalyzer(conf_motion_hd); } @@ -601,7 +600,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 = DataRate::KilobitsPerSec(2000); + conf_motion_hd.config->link_capacity_kbps = 2000; conf_motion_hd.call.generic_descriptor = true; fixture->RunWithAnalyzer(conf_motion_hd); } @@ -624,7 +623,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 = DataRate::KilobitsPerSec(2000); + conf_motion_hd.config->link_capacity_kbps = 2000; fixture->RunWithAnalyzer(conf_motion_hd); } @@ -646,7 +645,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 = DataRate::KilobitsPerSec(2000); + conf_motion_hd.config->link_capacity_kbps = 2000; fixture->RunWithAnalyzer(conf_motion_hd); } @@ -667,7 +666,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 = DataRate::KilobitsPerSec(30); + foreman_cif.config->link_capacity_kbps = 30; foreman_cif.call.generic_descriptor = true; fixture->RunWithAnalyzer(foreman_cif); } @@ -693,7 +692,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 = DataRate::KilobitsPerSec(1000); + conf_motion_hd.config->link_capacity_kbps = 1000; conf_motion_hd.call.generic_descriptor = true; fixture->RunWithAnalyzer(conf_motion_hd); } @@ -717,7 +716,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 = DataRate::KilobitsPerSec(2000); + conf_motion_hd.config->link_capacity_kbps = 2000; fixture->RunWithAnalyzer(conf_motion_hd); } #endif @@ -792,7 +791,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 = DataRate::KilobitsPerSec(500); + screenshare.config->link_capacity_kbps = 500; screenshare.call.generic_descriptor = true; fixture->RunWithAnalyzer(screenshare); } @@ -809,7 +808,7 @@ TEST(FullStackTest, Screenshare_Slides_Very_Lossy) { kFullStackTestDurationSecs}; screenshare.config->loss_percent = 10; screenshare.config->queue_delay_ms = 200; - screenshare.config->link_capacity = DataRate::KilobitsPerSec(500); + screenshare.config->link_capacity_kbps = 500; fixture->RunWithAnalyzer(screenshare); } @@ -824,7 +823,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 = DataRate::KilobitsPerSec(200); + screenshare.config->link_capacity_kbps = 200; screenshare.config->queue_length_packets = 30; fixture->RunWithAnalyzer(screenshare); @@ -841,7 +840,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 = DataRate::KilobitsPerSec(1200); + screenshare.config->link_capacity_kbps = 1200; screenshare.config->queue_length_packets = 30; fixture->RunWithAnalyzer(screenshare); @@ -954,7 +953,7 @@ TEST(FullStackTest, Vp9ksvc_3sl_Low_Bw_Limited) { "WebRTC-Vp9ExternalRefCtrl/Enabled/")); auto fixture = CreateVideoQualityTestFixture(); ParamsWithLogging simulcast; - simulcast.config->link_capacity = DataRate::KilobitsPerSec(500); + simulcast.config->link_capacity_kbps = 500; simulcast.call.send_side_bwe = true; simulcast.video[0] = SvcVp9Video(); simulcast.analyzer = {"vp9ksvc_3sl_low_bw_limited", 0.0, 0.0, @@ -977,7 +976,7 @@ TEST(FullStackTest, Vp9ksvc_3sl_Medium_Network_Restricted) { simulcast.ss[0] = { std::vector(), 0, 3, -1, InterLayerPredMode::kOnKeyPic, std::vector(), false}; - simulcast.config->link_capacity = DataRate::KilobitsPerSec(1000); + simulcast.config->link_capacity_kbps = 1000; simulcast.config->queue_delay_ms = 100; fixture->RunWithAnalyzer(simulcast); } @@ -995,7 +994,7 @@ TEST(FullStackTest, Vp9ksvc_3sl_Medium_Network_Restricted_Trusted_Rate) { simulcast.ss[0] = { std::vector(), 0, 3, -1, InterLayerPredMode::kOnKeyPic, std::vector(), false}; - simulcast.config->link_capacity = DataRate::KilobitsPerSec(1000); + simulcast.config->link_capacity_kbps = 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 f1d6494670..000316b45b 100644 --- a/video/pc_full_stack_tests.cc +++ b/video/pc_full_stack_tests.cc @@ -289,7 +289,7 @@ TEST(PCFullStackTest, Pc_Foreman_Cif_Link_150kbps_Net_Delay_0_0_Plr_0) { std::unique_ptr network_emulation_manager = CreateNetworkEmulationManager(); BuiltInNetworkBehaviorConfig config; - config.link_capacity = DataRate::KilobitsPerSec(150); + config.link_capacity_kbps = 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 network_emulation_manager = CreateNetworkEmulationManager(); BuiltInNetworkBehaviorConfig config; - config.link_capacity = DataRate::KilobitsPerSec(130); + config.link_capacity_kbps = 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 network_emulation_manager = CreateNetworkEmulationManager(); BuiltInNetworkBehaviorConfig config; - config.link_capacity = DataRate::KilobitsPerSec(50); + config.link_capacity_kbps = 50; config.queue_delay_ms = 100; config.loss_percent = 1; auto fixture = CreateTestFixture( @@ -357,7 +357,7 @@ TEST(PCFullStackTest, std::unique_ptr network_emulation_manager = CreateNetworkEmulationManager(); BuiltInNetworkBehaviorConfig config; - config.link_capacity = DataRate::KilobitsPerSec(150); + config.link_capacity_kbps = 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 network_emulation_manager = CreateNetworkEmulationManager(); BuiltInNetworkBehaviorConfig config; - config.link_capacity = DataRate::KilobitsPerSec(250); + config.link_capacity_kbps = 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 = DataRate::KilobitsPerSec(500); + config.link_capacity_kbps = 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 = DataRate::KilobitsPerSec(500); + config.link_capacity_kbps = 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 = DataRate::KilobitsPerSec(500); + config.link_capacity_kbps = 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 = DataRate::KilobitsPerSec(500); + config.link_capacity_kbps = 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 = DataRate::KilobitsPerSec(500); + config.link_capacity_kbps = 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 = DataRate::KilobitsPerSec(500); + config.link_capacity_kbps = 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 = DataRate::KilobitsPerSec(500); + foreman_cif.config->link_capacity_kbps = 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 = DataRate::KilobitsPerSec(1000); + config.link_capacity_kbps = 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 = DataRate::KilobitsPerSec(2000); + config.link_capacity_kbps = 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 = DataRate::KilobitsPerSec(2000); + conf_motion_hd.config->link_capacity_kbps = 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 = DataRate::KilobitsPerSec(2000); + conf_motion_hd.config->link_capacity_kbps = 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 = DataRate::KilobitsPerSec(2000); + conf_motion_hd.config->link_capacity_kbps = 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 = DataRate::KilobitsPerSec(2000); + config.link_capacity_kbps = 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 = DataRate::KilobitsPerSec(500); + screenshare.config->link_capacity_kbps = 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 = DataRate::KilobitsPerSec(500); + screenshare.config->link_capacity_kbps = 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 = DataRate::KilobitsPerSec(200); + screenshare.config->link_capacity_kbps = 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 = DataRate::KilobitsPerSec(1200); + screenshare.config->link_capacity_kbps = 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(), 0, 3, -1, InterLayerPredMode::kOnKeyPic, std::vector(), false}; - simulcast.config->link_capacity = DataRate::KilobitsPerSec(1000); + simulcast.config->link_capacity_kbps = 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(), 0, 3, -1, InterLayerPredMode::kOnKeyPic, std::vector(), false}; - simulcast.config->link_capacity = DataRate::KilobitsPerSec(1000); + simulcast.config->link_capacity_kbps = 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 = DataRate::KilobitsPerSec(7500); + dual_streams.config->link_capacity_kbps = 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 = DataRate::KilobitsPerSec(5000); + dual_streams.config->link_capacity_kbps = 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 9cbe5012dc..607a5d54f4 100644 --- a/video/screenshare_loopback.cc +++ b/video/screenshare_loopback.cc @@ -20,7 +20,6 @@ #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" @@ -314,8 +313,7 @@ std::vector Slides() { void Loopback() { BuiltInNetworkBehaviorConfig pipe_config; pipe_config.loss_percent = LossPercent(); - pipe_config.link_capacity = - webrtc::DataRate::KilobitsPerSec(LinkCapacityKbps()); + pipe_config.link_capacity_kbps = 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 67b27e865c..b0a90a017d 100644 --- a/video/sv_loopback.cc +++ b/video/sv_loopback.cc @@ -20,7 +20,6 @@ #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" @@ -585,7 +584,7 @@ void Loopback() { BuiltInNetworkBehaviorConfig pipe_config; pipe_config.loss_percent = LossPercent(); pipe_config.avg_burst_loss_length = AvgBurstLossLength(); - pipe_config.link_capacity = DataRate::KilobitsPerSec(LinkCapacityKbps()); + pipe_config.link_capacity_kbps = 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 973ffe60c8..50c6f2b992 100644 --- a/video/video_loopback.cc +++ b/video/video_loopback.cc @@ -21,7 +21,6 @@ #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" @@ -358,7 +357,7 @@ void Loopback() { BuiltInNetworkBehaviorConfig pipe_config; pipe_config.loss_percent = LossPercent(); pipe_config.avg_burst_loss_length = AvgBurstLossLength(); - pipe_config.link_capacity = DataRate::KilobitsPerSec(LinkCapacityKbps()); + pipe_config.link_capacity_kbps = 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 82373548bc..21698ce4fd 100644 --- a/video/video_send_stream_tests.cc +++ b/video/video_send_stream_tests.cc @@ -18,7 +18,6 @@ #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" @@ -1461,7 +1460,7 @@ TEST_F(VideoSendStreamTest, PaddingIsPrimarilyRetransmissions) { const int kNetworkDelayMs = 50; BuiltInNetworkBehaviorConfig config; config.loss_percent = 10; - config.link_capacity = DataRate::KilobitsPerSec(kCapacityKbps); + config.link_capacity_kbps = kCapacityKbps; config.queue_delay_ms = kNetworkDelayMs; return config; }