From aaf14f6d459ca4283cba8e7ce2d6aba32706c6d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Thu, 23 Mar 2023 19:28:28 +0100 Subject: [PATCH] Add standard L1T3 test that all layers can be inactived. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A similar test to this was landed but got reverted due to failing on the importer bot. That is being investigated here[1]. This CL relands parts of the original test that we believe are NOT causing issues. This CL is not expected to fail on the importer, let's land and verify. [1] https://webrtc-review.googlesource.com/c/src/+/299006 Bug: webrtc:15033 Change-Id: If11e459b17d3606da3ddff0742e5429c642f7e83 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/299007 Commit-Queue: Henrik Boström Reviewed-by: Evan Shrubsole Cr-Commit-Position: refs/heads/main@{#39666} --- pc/peer_connection_simulcast_unittest.cc | 41 ++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/pc/peer_connection_simulcast_unittest.cc b/pc/peer_connection_simulcast_unittest.cc index 92c0eba008..41e2c81100 100644 --- a/pc/peer_connection_simulcast_unittest.cc +++ b/pc/peer_connection_simulcast_unittest.cc @@ -1557,6 +1557,47 @@ TEST_F(PeerConnectionSimulcastWithMediaFlowTests, EXPECT_FALSE(parameters.encodings[2].scalability_mode.has_value()); } +TEST_F(PeerConnectionSimulcastWithMediaFlowTests, + SendingThreeEncodings_VP9_StandardL1T3_AllLayersInactive) { + rtc::scoped_refptr local_pc_wrapper = CreatePc(); + rtc::scoped_refptr remote_pc_wrapper = CreatePc(); + ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper); + + std::vector layers = + CreateLayers({"f", "h", "q"}, /*active=*/true); + rtc::scoped_refptr transceiver = + AddTransceiverWithSimulcastLayers(local_pc_wrapper, remote_pc_wrapper, + layers); + std::vector codecs = + GetCapabilitiesAndRestrictToCodec(local_pc_wrapper, "VP9"); + transceiver->SetCodecPreferences(codecs); + + // Standard mode and all layers inactive. + rtc::scoped_refptr sender = transceiver->sender(); + RtpParameters parameters = sender->GetParameters(); + ASSERT_EQ(parameters.encodings.size(), 3u); + parameters.encodings[0].scalability_mode = "L1T3"; + 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 report = GetStats(local_pc_wrapper); + std::vector outbound_rtps = + report->GetStatsOfType(); + 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(PeerConnectionSimulcastWithMediaFlowTests, SendingThreeEncodings_AV1_Simulcast) { rtc::scoped_refptr local_pc_wrapper = CreatePc();