From e16942b5f13dd3de19fbf5e6a424819d23e07602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Fri, 3 Mar 2023 13:07:15 +0100 Subject: [PATCH] Confirm that L1T1 is the default for VP8 singlecast. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test does not change any parameters. Bug: webrtc:14884 Change-Id: Ic315c1b10e729f1f179570350028eef604d714b4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/296041 Reviewed-by: Ilya Nikolaevskiy Reviewed-by: Evan Shrubsole Commit-Queue: Henrik Boström Cr-Commit-Position: refs/heads/main@{#39473} --- pc/peer_connection_simulcast_unittest.cc | 45 ++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/pc/peer_connection_simulcast_unittest.cc b/pc/peer_connection_simulcast_unittest.cc index ad90171105..ee6ce771bb 100644 --- a/pc/peer_connection_simulcast_unittest.cc +++ b/pc/peer_connection_simulcast_unittest.cc @@ -984,8 +984,12 @@ class PeerConnectionSimulcastWithMediaFlowTests std::vector outbound_rtps = report->GetStatsOfType(); for (const RidAndResolution& resolution : resolutions) { - const auto* outbound_rtp = - FindOutboundRtpByRid(outbound_rtps, resolution.rid); + const RTCOutboundRTPStreamStats* outbound_rtp = nullptr; + if (!resolution.rid.empty()) { + outbound_rtp = FindOutboundRtpByRid(outbound_rtps, resolution.rid); + } else if (outbound_rtps.size() == 1u) { + outbound_rtp = outbound_rtps[0]; + } if (!outbound_rtp || !outbound_rtp->frame_width.is_defined() || !outbound_rtp->frame_height.is_defined()) { // RTP not found by rid or has not encoded a frame yet. @@ -1067,6 +1071,43 @@ class PeerConnectionSimulcastWithMediaFlowTests std::unique_ptr background_thread_; }; +TEST_F(PeerConnectionSimulcastWithMediaFlowTests, + SendingOneEncodings_VP8_DefaultsToL1T1) { + 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"}, /*active=*/true); + rtc::scoped_refptr transceiver = + AddTransceiverWithSimulcastLayers(local_pc_wrapper, remote_pc_wrapper, + layers); + std::vector codecs = + GetCapabilitiesAndRestrictToCodec(local_pc_wrapper, "VP8"); + transceiver->SetCodecPreferences(codecs); + + NegotiateWithSimulcastTweaks(local_pc_wrapper, remote_pc_wrapper, layers); + local_pc_wrapper->WaitForConnection(); + remote_pc_wrapper->WaitForConnection(); + + // Wait until media is flowing. + EXPECT_TRUE_WAIT(HasOutboundRtpBytesSent(local_pc_wrapper, 1u), + kDefaultTimeout.ms()); + // Significant ramp up time is needed until maximum resolution is achieved so + // we disable `log_during_ramp_up` to avoid log spam. + EXPECT_TRUE_WAIT( + HasOutboundRtpExpectedResolutions(local_pc_wrapper, {{"", 1280, 720}}, + /*log_during_ramp_up=*/false), + kLongTimeoutForRampingUp.ms()); + // Verify codec and scalability mode. + rtc::scoped_refptr report = GetStats(local_pc_wrapper); + std::vector outbound_rtps = + report->GetStatsOfType(); + ASSERT_THAT(outbound_rtps, SizeIs(1u)); + EXPECT_THAT(GetCurrentCodecMimeType(report, *outbound_rtps[0]), + StrCaseEq("video/VP8")); + EXPECT_THAT(*outbound_rtps[0]->scalability_mode, StrEq("L1T1")); +} + TEST_F(PeerConnectionSimulcastWithMediaFlowTests, SendingThreeEncodings_VP8_Simulcast) { rtc::scoped_refptr local_pc_wrapper = CreatePc();