diff --git a/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc b/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc index c6537aa5f8..0227027954 100644 --- a/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc +++ b/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc @@ -412,7 +412,7 @@ TEST_F(GoogCcNetworkControllerTest, LimitsToFloorIfRttIsHighInTrial) { // Wait to allow the high RTT to be detected and acted upon. s.RunFor(TimeDelta::seconds(4)); // By now the target rate should have dropped to the minimum configured rate. - EXPECT_NEAR(client->target_rate().kbps(), kBandwidthFloor.kbps(), 1); + EXPECT_NEAR(client->target_rate().kbps(), kBandwidthFloor.kbps(), 5); } TEST_F(GoogCcNetworkControllerTest, UpdatesTargetRateBasedOnLinkCapacity) { @@ -502,7 +502,10 @@ DataRate AverageBitrateAfterCrossInducedLoss(std::string name) { auto* client = s.CreateClient("send", CallClientConfig()); auto* route = s.CreateRoutes( client, send_net, s.CreateClient("return", CallClientConfig()), ret_net); - auto* video = s.CreateVideoStream(route->forward(), VideoStreamConfig()); + // TODO(srte): Make this work with RTX enabled or remove it. + auto* video = s.CreateVideoStream(route->forward(), [](VideoStreamConfig* c) { + c->stream.use_rtx = false; + }); s.RunFor(TimeDelta::seconds(10)); for (int i = 0; i < 4; ++i) { // Sends TCP cross traffic inducing loss. @@ -521,7 +524,7 @@ DataRate AverageBitrateAfterCrossInducedLoss(std::string name) { TEST_F(GoogCcNetworkControllerTest, NoLossBasedRecoversSlowerAfterCrossInducedLoss) { - // This test acts as a reference for the test below, showing that wihtout the + // This test acts as a reference for the test below, showing that without the // trial, we have worse behavior. DataRate average_bitrate = AverageBitrateAfterCrossInducedLoss("googcc_unit/no_cross_loss_based"); diff --git a/modules/congestion_controller/pcc/pcc_network_controller_unittest.cc b/modules/congestion_controller/pcc/pcc_network_controller_unittest.cc index 54c98302c0..2383378ccc 100644 --- a/modules/congestion_controller/pcc/pcc_network_controller_unittest.cc +++ b/modules/congestion_controller/pcc/pcc_network_controller_unittest.cc @@ -91,7 +91,9 @@ TEST(PccNetworkControllerTest, UpdatesTargetSendRate) { auto* route = s.CreateRoutes(client, {send_net->node()}, s.CreateClient("return", CallClientConfig()), {ret_net->node()}); - s.CreateVideoStream(route->forward(), VideoStreamConfig()); + VideoStreamConfig video; + video.stream.use_rtx = false; + s.CreateVideoStream(route->forward(), video); s.RunFor(TimeDelta::seconds(30)); EXPECT_NEAR(client->target_rate().kbps(), 450, 100); send_net->UpdateConfig([](NetworkSimulationConfig* c) { diff --git a/test/scenario/video_stream.cc b/test/scenario/video_stream.cc index 7fd9d1518a..370b225112 100644 --- a/test/scenario/video_stream.cc +++ b/test/scenario/video_stream.cc @@ -120,9 +120,11 @@ std::string TransformFilePath(std::string path) { return path; } -VideoSendStream::Config CreateVideoSendStreamConfig(VideoStreamConfig config, - std::vector ssrcs, - Transport* send_transport) { +VideoSendStream::Config CreateVideoSendStreamConfig( + VideoStreamConfig config, + std::vector ssrcs, + std::vector rtx_ssrcs, + Transport* send_transport) { VideoSendStream::Config send_config(send_transport); send_config.rtp.payload_name = CodecTypeToPayloadString(config.encoder.codec); send_config.rtp.payload_type = CodecTypeToPayloadType(config.encoder.codec); @@ -132,6 +134,10 @@ VideoSendStream::Config CreateVideoSendStreamConfig(VideoStreamConfig config, send_config.rtp.ssrcs = ssrcs; send_config.rtp.extensions = GetVideoRtpExtensions(config); + if (config.stream.use_rtx) { + send_config.rtp.rtx.payload_type = CallTest::kSendRtxPayloadType; + send_config.rtp.rtx.ssrcs = rtx_ssrcs; + } if (config.stream.use_flexfec) { send_config.rtp.flexfec.payload_type = CallTest::kFlexfecPayloadType; send_config.rtp.flexfec.ssrc = CallTest::kFlexfecSendSsrc; @@ -398,7 +404,7 @@ SendVideoStream::SendVideoStream(CallClient* sender, rtx_ssrcs_.push_back(sender->GetNextRtxSsrc()); } VideoSendStream::Config send_config = - CreateVideoSendStreamConfig(config, ssrcs_, send_transport); + CreateVideoSendStreamConfig(config, ssrcs_, rtx_ssrcs_, send_transport); send_config.encoder_settings.encoder_factory = encoder_factory_.get(); send_config.encoder_settings.bitrate_allocator_factory = bitrate_allocator_factory_.get(); diff --git a/test/scenario/video_stream_unittest.cc b/test/scenario/video_stream_unittest.cc index 74dc9a2f51..0789b0d564 100644 --- a/test/scenario/video_stream_unittest.cc +++ b/test/scenario/video_stream_unittest.cc @@ -126,8 +126,11 @@ TEST(VideoStreamTest, SendsNacksOnLoss) { // NACK retransmissions are enabled by default. auto video = s.CreateVideoStream(route->forward(), VideoStreamConfig()); s.RunFor(TimeDelta::seconds(1)); - auto stream_stats = video->send()->GetStats().substreams.begin()->second; - EXPECT_GT(stream_stats.rtp_stats.retransmitted.packets, 0u); + int retransmit_packets = 0; + for (const auto& substream : video->send()->GetStats().substreams) { + retransmit_packets += substream.second.rtp_stats.retransmitted.packets; + } + EXPECT_GT(retransmit_packets, 0); } TEST(VideoStreamTest, SendsFecWithUlpFec) { @@ -136,6 +139,7 @@ TEST(VideoStreamTest, SendsFecWithUlpFec) { s.CreateRoutes(s.CreateClient("caller", CallClientConfig()), {s.CreateSimulationNode([](NetworkSimulationConfig* c) { c->loss_rate = 0.1; + c->delay = TimeDelta::ms(100); })}, s.CreateClient("callee", CallClientConfig()), {s.CreateSimulationNode(NetworkSimulationConfig())}); @@ -154,6 +158,7 @@ TEST(VideoStreamTest, SendsFecWithFlexFec) { s.CreateRoutes(s.CreateClient("caller", CallClientConfig()), {s.CreateSimulationNode([](NetworkSimulationConfig* c) { c->loss_rate = 0.1; + c->delay = TimeDelta::ms(100); })}, s.CreateClient("callee", CallClientConfig()), {s.CreateSimulationNode(NetworkSimulationConfig())});