Add tests for adding many transceivers and renegotiating.

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 <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32820}
This commit is contained in:
Harald Alvestrand
2020-12-11 14:53:59 +00:00
committed by Commit Bot
parent 064be38380
commit 1a9be30702

View File

@ -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,