Add SVC tests that all layers can be inactive.
This CL contains [1] and [2], tests that have previously been reverted
due to an issue with VP9 that was fixed in [3]. The re-landed tests
have been renamed as this test suite is now called
PeerConnectionEncodingsIntegrationTest.
[1] https://webrtc-review.googlesource.com/c/src/+/299146
[2] https://webrtc-review.googlesource.com/c/src/+/299008
[3] https://chromium.googlesource.com/chromium/src/+/d26fc16a1b6cb621f4d9a1caeb05b6b6287d0b91
Bug: webrtc:15033
Change-Id: I4c2b2c0ff3e708ec3a50d38a92214ca9c9ddd8c5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/300840
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39802}
diff --git a/pc/peer_connection_encodings_integrationtest.cc b/pc/peer_connection_encodings_integrationtest.cc
index 6868712..5ae970b 100644
--- a/pc/peer_connection_encodings_integrationtest.cc
+++ b/pc/peer_connection_encodings_integrationtest.cc
@@ -701,7 +701,7 @@
// Configure SVC, a.k.a. "L3T3_KEY".
rtc::scoped_refptr<RtpSenderInterface> sender = transceiver->sender();
RtpParameters parameters = sender->GetParameters();
- ASSERT_EQ(parameters.encodings.size(), 3u);
+ ASSERT_THAT(parameters.encodings, SizeIs(3));
parameters.encodings[0].scalability_mode = "L3T3_KEY";
parameters.encodings[0].scale_resolution_down_by = 1;
parameters.encodings[1].active = false;
@@ -724,7 +724,7 @@
// GetParameters() is consistent with what we asked for and got.
parameters = sender->GetParameters();
- ASSERT_EQ(parameters.encodings.size(), 3u);
+ ASSERT_THAT(parameters.encodings, SizeIs(3));
EXPECT_THAT(parameters.encodings[0].scalability_mode,
Optional(std::string("L3T3_KEY")));
EXPECT_FALSE(parameters.encodings[1].scalability_mode.has_value());
@@ -750,7 +750,7 @@
// `scalability_mode` and `scale_resolution_down_by` parameters.
rtc::scoped_refptr<RtpSenderInterface> sender = transceiver->sender();
RtpParameters parameters = sender->GetParameters();
- ASSERT_EQ(parameters.encodings.size(), 3u);
+ ASSERT_THAT(parameters.encodings, SizeIs(3));
parameters.encodings[0].scalability_mode = "L1T3";
parameters.encodings[0].scale_resolution_down_by = 4;
parameters.encodings[1].scalability_mode = "L1T3";
@@ -765,7 +765,7 @@
// GetParameters() does not report any fallback.
parameters = sender->GetParameters();
- ASSERT_EQ(parameters.encodings.size(), 3u);
+ ASSERT_THAT(parameters.encodings, SizeIs(3));
EXPECT_THAT(parameters.encodings[0].scalability_mode,
Optional(std::string("L1T3")));
EXPECT_THAT(parameters.encodings[1].scalability_mode,
@@ -824,7 +824,7 @@
// Test coverage for https://crbug.com/webrtc/15016.
rtc::scoped_refptr<RtpSenderInterface> sender = transceiver->sender();
RtpParameters parameters = sender->GetParameters();
- ASSERT_EQ(parameters.encodings.size(), 3u);
+ ASSERT_THAT(parameters.encodings, SizeIs(3));
parameters.encodings[0].active = true;
parameters.encodings[0].scalability_mode = "L2T2_KEY";
parameters.encodings[0].scale_resolution_down_by = 2.0;
@@ -846,7 +846,7 @@
// GetParameters() does not report any fallback.
parameters = sender->GetParameters();
- ASSERT_EQ(parameters.encodings.size(), 3u);
+ ASSERT_THAT(parameters.encodings, SizeIs(3));
EXPECT_THAT(parameters.encodings[0].scalability_mode,
Optional(std::string("L2T2_KEY")));
EXPECT_FALSE(parameters.encodings[1].scalability_mode.has_value());
@@ -854,6 +854,84 @@
}
TEST_F(PeerConnectionEncodingsIntegrationTest,
+ SendingThreeEncodings_VP9_LegacySVC_AllLayersInactive) {
+ rtc::scoped_refptr<PeerConnectionTestWrapper> local_pc_wrapper = CreatePc();
+ rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
+ ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
+
+ std::vector<cricket::SimulcastLayer> layers =
+ CreateLayers({"f", "h", "q"}, /*active=*/true);
+ rtc::scoped_refptr<RtpTransceiverInterface> transceiver =
+ AddTransceiverWithSimulcastLayers(local_pc_wrapper, remote_pc_wrapper,
+ layers);
+ std::vector<RtpCodecCapability> codecs =
+ GetCapabilitiesAndRestrictToCodec(local_pc_wrapper, "VP9");
+ transceiver->SetCodecPreferences(codecs);
+
+ // Legacy SVC mode and all layers inactive.
+ rtc::scoped_refptr<RtpSenderInterface> sender = transceiver->sender();
+ RtpParameters parameters = sender->GetParameters();
+ ASSERT_THAT(parameters.encodings, SizeIs(3));
+ parameters.encodings[0].active = false;
+ parameters.encodings[1].active = false;
+ parameters.encodings[2].active = false;
+ sender->SetParameters(parameters);
+
+ NegotiateWithSimulcastTweaks(local_pc_wrapper, remote_pc_wrapper, layers);
+ local_pc_wrapper->WaitForConnection();
+ remote_pc_wrapper->WaitForConnection();
+
+ // Ensure no media is flowing (1 second should be enough).
+ rtc::Thread::Current()->SleepMs(1000);
+ rtc::scoped_refptr<const RTCStatsReport> report = GetStats(local_pc_wrapper);
+ std::vector<const RTCOutboundRtpStreamStats*> outbound_rtps =
+ report->GetStatsOfType<RTCOutboundRtpStreamStats>();
+ ASSERT_THAT(outbound_rtps, SizeIs(1u));
+ EXPECT_EQ(*outbound_rtps[0]->bytes_sent, 0u);
+}
+
+TEST_F(PeerConnectionEncodingsIntegrationTest,
+ SendingThreeEncodings_VP9_StandardSVC_AllLayersInactive) {
+ rtc::scoped_refptr<PeerConnectionTestWrapper> local_pc_wrapper = CreatePc();
+ rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
+ ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
+
+ std::vector<cricket::SimulcastLayer> layers =
+ CreateLayers({"f", "h", "q"}, /*active=*/true);
+ rtc::scoped_refptr<RtpTransceiverInterface> transceiver =
+ AddTransceiverWithSimulcastLayers(local_pc_wrapper, remote_pc_wrapper,
+ layers);
+ std::vector<RtpCodecCapability> codecs =
+ GetCapabilitiesAndRestrictToCodec(local_pc_wrapper, "VP9");
+ transceiver->SetCodecPreferences(codecs);
+
+ // Standard mode and all layers inactive.
+ rtc::scoped_refptr<RtpSenderInterface> sender = transceiver->sender();
+ RtpParameters parameters = sender->GetParameters();
+ ASSERT_THAT(parameters.encodings, SizeIs(3));
+ parameters.encodings[0].scalability_mode = "L3T3_KEY";
+ parameters.encodings[0].scale_resolution_down_by = 1;
+ parameters.encodings[0].active = false;
+ parameters.encodings[1].active = false;
+ parameters.encodings[2].active = false;
+ sender->SetParameters(parameters);
+
+ NegotiateWithSimulcastTweaks(local_pc_wrapper, remote_pc_wrapper, layers);
+ local_pc_wrapper->WaitForConnection();
+ remote_pc_wrapper->WaitForConnection();
+
+ // Ensure no media is flowing (1 second should be enough).
+ rtc::Thread::Current()->SleepMs(1000);
+ rtc::scoped_refptr<const RTCStatsReport> report = GetStats(local_pc_wrapper);
+ std::vector<const RTCOutboundRtpStreamStats*> outbound_rtps =
+ report->GetStatsOfType<RTCOutboundRtpStreamStats>();
+ ASSERT_THAT(outbound_rtps, SizeIs(3u));
+ EXPECT_EQ(*outbound_rtps[0]->bytes_sent, 0u);
+ EXPECT_EQ(*outbound_rtps[1]->bytes_sent, 0u);
+ EXPECT_EQ(*outbound_rtps[2]->bytes_sent, 0u);
+}
+
+TEST_F(PeerConnectionEncodingsIntegrationTest,
SendingThreeEncodings_VP9_StandardL1T3_AllLayersInactive) {
rtc::scoped_refptr<PeerConnectionTestWrapper> local_pc_wrapper = CreatePc();
rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
@@ -871,7 +949,7 @@
// Standard mode and all layers inactive.
rtc::scoped_refptr<RtpSenderInterface> sender = transceiver->sender();
RtpParameters parameters = sender->GetParameters();
- ASSERT_EQ(parameters.encodings.size(), 3u);
+ ASSERT_THAT(parameters.encodings, SizeIs(3));
parameters.encodings[0].scalability_mode = "L1T3";
parameters.encodings[0].scale_resolution_down_by = 1;
parameters.encodings[0].active = false;
@@ -919,7 +997,7 @@
// `scalability_mode`.
rtc::scoped_refptr<RtpSenderInterface> sender = transceiver->sender();
RtpParameters parameters = sender->GetParameters();
- ASSERT_EQ(parameters.encodings.size(), 3u);
+ ASSERT_THAT(parameters.encodings, SizeIs(3));
parameters.encodings[0].scalability_mode = "L1T3";
parameters.encodings[0].scale_resolution_down_by = 4;
parameters.encodings[1].scalability_mode = "L1T3";
@@ -934,7 +1012,7 @@
// GetParameters() does not report any fallback.
parameters = sender->GetParameters();
- ASSERT_EQ(parameters.encodings.size(), 3u);
+ ASSERT_THAT(parameters.encodings, SizeIs(3));
EXPECT_THAT(parameters.encodings[0].scalability_mode,
Optional(std::string("L1T3")));
EXPECT_THAT(parameters.encodings[1].scalability_mode,