From 1a9be307026b47116c569575cd4afd6dbaca0743 Mon Sep 17 00:00:00 2001 From: Harald Alvestrand Date: Fri, 11 Dec 2020 14:53:59 +0000 Subject: [PATCH] Add tests for adding many transceivers and renegotiating. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These tests create multiple transceivers, and attempt to renegotiate. They serve to show where the limit is for adequate performance (arbitrarily set as one second). This version should pass on all platforms; it only tests up to 16 tracks. Bug: webrtc:12176 Change-Id: I1561a56f6a392dbfa954319c538a9959c3a6f590 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/193061 Commit-Queue: Harald Alvestrand Reviewed-by: Henrik Boström Cr-Commit-Position: refs/heads/master@{#32820} --- pc/peer_connection_integrationtest.cc | 68 +++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/pc/peer_connection_integrationtest.cc b/pc/peer_connection_integrationtest.cc index 88de3a434c..30b24948d6 100644 --- a/pc/peer_connection_integrationtest.cc +++ b/pc/peer_connection_integrationtest.cc @@ -5460,6 +5460,74 @@ TEST_F(PeerConnectionIntegrationTestUnifiedPlan, caller()->CreateOfferAndWait(); } +TEST_F(PeerConnectionIntegrationTestUnifiedPlan, + ReegotiateManyAudioTransceivers) { + PeerConnectionInterface::RTCConfiguration config; + config.sdp_semantics = SdpSemantics::kUnifiedPlan; + ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(config, config)); + ConnectFakeSignaling(); + caller()->pc()->AddTransceiver(cricket::MEDIA_TYPE_AUDIO); + + caller()->CreateAndSetAndSignalOffer(); + ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); + int current_size = caller()->pc()->GetTransceivers().size(); + // Add more tracks until we get close to having issues. + // Issues have been seen at: + // - 32 tracks on android_arm64_rel and android_arm_dbg bots + while (current_size < 16) { + // Double the number of tracks + for (int i = 0; i < current_size; i++) { + caller()->pc()->AddTransceiver(cricket::MEDIA_TYPE_AUDIO); + } + current_size = caller()->pc()->GetTransceivers().size(); + RTC_LOG(LS_INFO) << "Renegotiating with " << current_size << " tracks"; + auto start_time_ms = rtc::TimeMillis(); + caller()->CreateAndSetAndSignalOffer(); + // We want to stop when the time exceeds one second. + ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); + auto elapsed_time_ms = rtc::TimeMillis() - start_time_ms; + RTC_LOG(LS_INFO) << "Renegotiating took " << elapsed_time_ms << " ms"; + ASSERT_GT(1000, elapsed_time_ms) + << "Audio transceivers: Negotiation took too long after " + << current_size << " tracks added"; + } +} + +TEST_F(PeerConnectionIntegrationTestUnifiedPlan, + RenegotiateManyVideoTransceivers) { + PeerConnectionInterface::RTCConfiguration config; + config.sdp_semantics = SdpSemantics::kUnifiedPlan; + ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(config, config)); + ConnectFakeSignaling(); + caller()->pc()->AddTransceiver(cricket::MEDIA_TYPE_VIDEO); + + caller()->CreateAndSetAndSignalOffer(); + ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); + int current_size = caller()->pc()->GetTransceivers().size(); + // Add more tracks until we get close to having issues. + // Issues have been seen at: + // - 96 on a Linux workstation + // - 64 at win_x86_more_configs and win_x64_msvc_dbg + // - 32 on android_arm64_rel and linux_dbg bots + while (current_size < 16) { + // Double the number of tracks + for (int i = 0; i < current_size; i++) { + caller()->pc()->AddTransceiver(cricket::MEDIA_TYPE_VIDEO); + } + current_size = caller()->pc()->GetTransceivers().size(); + RTC_LOG(LS_INFO) << "Renegotiating with " << current_size << " tracks"; + auto start_time_ms = rtc::TimeMillis(); + caller()->CreateAndSetAndSignalOffer(); + // We want to stop when the time exceeds one second. + ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); + auto elapsed_time_ms = rtc::TimeMillis() - start_time_ms; + RTC_LOG(LS_INFO) << "Renegotiating took " << elapsed_time_ms << " ms"; + ASSERT_GT(1000, elapsed_time_ms) + << "Video transceivers: Negotiation took too long after " + << current_size << " tracks added"; + } +} + INSTANTIATE_TEST_SUITE_P(PeerConnectionIntegrationTest, PeerConnectionIntegrationTest, Values(SdpSemantics::kPlanB,