Use RTX SSRCs in scenario test framework.

Using RTX SSRCs and payload type for retransmission of video. This
corresponds to the behavior when using the peer connection API.

Bug: webrtc:9883
Change-Id: Ic0e3964d097f42219ca225513a4bc771d70ccaa4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/164460
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30248}
This commit is contained in:
Sebastian Jansson
2020-01-14 12:30:13 +01:00
committed by Commit Bot
parent 2a92d2b461
commit 3e66a498c3
4 changed files with 26 additions and 10 deletions

View File

@ -412,7 +412,7 @@ TEST_F(GoogCcNetworkControllerTest, LimitsToFloorIfRttIsHighInTrial) {
// Wait to allow the high RTT to be detected and acted upon. // Wait to allow the high RTT to be detected and acted upon.
s.RunFor(TimeDelta::seconds(4)); s.RunFor(TimeDelta::seconds(4));
// By now the target rate should have dropped to the minimum configured rate. // 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) { TEST_F(GoogCcNetworkControllerTest, UpdatesTargetRateBasedOnLinkCapacity) {
@ -502,7 +502,10 @@ DataRate AverageBitrateAfterCrossInducedLoss(std::string name) {
auto* client = s.CreateClient("send", CallClientConfig()); auto* client = s.CreateClient("send", CallClientConfig());
auto* route = s.CreateRoutes( auto* route = s.CreateRoutes(
client, send_net, s.CreateClient("return", CallClientConfig()), ret_net); 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)); s.RunFor(TimeDelta::seconds(10));
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
// Sends TCP cross traffic inducing loss. // Sends TCP cross traffic inducing loss.
@ -521,7 +524,7 @@ DataRate AverageBitrateAfterCrossInducedLoss(std::string name) {
TEST_F(GoogCcNetworkControllerTest, TEST_F(GoogCcNetworkControllerTest,
NoLossBasedRecoversSlowerAfterCrossInducedLoss) { 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. // trial, we have worse behavior.
DataRate average_bitrate = DataRate average_bitrate =
AverageBitrateAfterCrossInducedLoss("googcc_unit/no_cross_loss_based"); AverageBitrateAfterCrossInducedLoss("googcc_unit/no_cross_loss_based");

View File

@ -91,7 +91,9 @@ TEST(PccNetworkControllerTest, UpdatesTargetSendRate) {
auto* route = s.CreateRoutes(client, {send_net->node()}, auto* route = s.CreateRoutes(client, {send_net->node()},
s.CreateClient("return", CallClientConfig()), s.CreateClient("return", CallClientConfig()),
{ret_net->node()}); {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)); s.RunFor(TimeDelta::seconds(30));
EXPECT_NEAR(client->target_rate().kbps(), 450, 100); EXPECT_NEAR(client->target_rate().kbps(), 450, 100);
send_net->UpdateConfig([](NetworkSimulationConfig* c) { send_net->UpdateConfig([](NetworkSimulationConfig* c) {

View File

@ -120,9 +120,11 @@ std::string TransformFilePath(std::string path) {
return path; return path;
} }
VideoSendStream::Config CreateVideoSendStreamConfig(VideoStreamConfig config, VideoSendStream::Config CreateVideoSendStreamConfig(
std::vector<uint32_t> ssrcs, VideoStreamConfig config,
Transport* send_transport) { std::vector<uint32_t> ssrcs,
std::vector<uint32_t> rtx_ssrcs,
Transport* send_transport) {
VideoSendStream::Config send_config(send_transport); VideoSendStream::Config send_config(send_transport);
send_config.rtp.payload_name = CodecTypeToPayloadString(config.encoder.codec); send_config.rtp.payload_name = CodecTypeToPayloadString(config.encoder.codec);
send_config.rtp.payload_type = CodecTypeToPayloadType(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.ssrcs = ssrcs;
send_config.rtp.extensions = GetVideoRtpExtensions(config); 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) { if (config.stream.use_flexfec) {
send_config.rtp.flexfec.payload_type = CallTest::kFlexfecPayloadType; send_config.rtp.flexfec.payload_type = CallTest::kFlexfecPayloadType;
send_config.rtp.flexfec.ssrc = CallTest::kFlexfecSendSsrc; send_config.rtp.flexfec.ssrc = CallTest::kFlexfecSendSsrc;
@ -398,7 +404,7 @@ SendVideoStream::SendVideoStream(CallClient* sender,
rtx_ssrcs_.push_back(sender->GetNextRtxSsrc()); rtx_ssrcs_.push_back(sender->GetNextRtxSsrc());
} }
VideoSendStream::Config send_config = 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.encoder_factory = encoder_factory_.get();
send_config.encoder_settings.bitrate_allocator_factory = send_config.encoder_settings.bitrate_allocator_factory =
bitrate_allocator_factory_.get(); bitrate_allocator_factory_.get();

View File

@ -126,8 +126,11 @@ TEST(VideoStreamTest, SendsNacksOnLoss) {
// NACK retransmissions are enabled by default. // NACK retransmissions are enabled by default.
auto video = s.CreateVideoStream(route->forward(), VideoStreamConfig()); auto video = s.CreateVideoStream(route->forward(), VideoStreamConfig());
s.RunFor(TimeDelta::seconds(1)); s.RunFor(TimeDelta::seconds(1));
auto stream_stats = video->send()->GetStats().substreams.begin()->second; int retransmit_packets = 0;
EXPECT_GT(stream_stats.rtp_stats.retransmitted.packets, 0u); for (const auto& substream : video->send()->GetStats().substreams) {
retransmit_packets += substream.second.rtp_stats.retransmitted.packets;
}
EXPECT_GT(retransmit_packets, 0);
} }
TEST(VideoStreamTest, SendsFecWithUlpFec) { TEST(VideoStreamTest, SendsFecWithUlpFec) {
@ -136,6 +139,7 @@ TEST(VideoStreamTest, SendsFecWithUlpFec) {
s.CreateRoutes(s.CreateClient("caller", CallClientConfig()), s.CreateRoutes(s.CreateClient("caller", CallClientConfig()),
{s.CreateSimulationNode([](NetworkSimulationConfig* c) { {s.CreateSimulationNode([](NetworkSimulationConfig* c) {
c->loss_rate = 0.1; c->loss_rate = 0.1;
c->delay = TimeDelta::ms(100);
})}, })},
s.CreateClient("callee", CallClientConfig()), s.CreateClient("callee", CallClientConfig()),
{s.CreateSimulationNode(NetworkSimulationConfig())}); {s.CreateSimulationNode(NetworkSimulationConfig())});
@ -154,6 +158,7 @@ TEST(VideoStreamTest, SendsFecWithFlexFec) {
s.CreateRoutes(s.CreateClient("caller", CallClientConfig()), s.CreateRoutes(s.CreateClient("caller", CallClientConfig()),
{s.CreateSimulationNode([](NetworkSimulationConfig* c) { {s.CreateSimulationNode([](NetworkSimulationConfig* c) {
c->loss_rate = 0.1; c->loss_rate = 0.1;
c->delay = TimeDelta::ms(100);
})}, })},
s.CreateClient("callee", CallClientConfig()), s.CreateClient("callee", CallClientConfig()),
{s.CreateSimulationNode(NetworkSimulationConfig())}); {s.CreateSimulationNode(NetworkSimulationConfig())});