Verify GetSources is not flaky for unsignaled SSRCs.

This test verifies perkj's fixes in https://crbug.com/webrtc/14817.
I ran the test 6000 times locally and it didn't fail once.

Bug: webrtc:14817
Change-Id: I3f78f3ae2ca09b328cbfa12a89ad228d3de899c2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/294522
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Auto-Submit: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39365}
This commit is contained in:
Henrik Boström 2023-02-22 10:30:19 +01:00 committed by WebRTC LUCI CQ
parent e7478182ac
commit 39dab96b98

View File

@ -2794,6 +2794,31 @@ TEST_P(PeerConnectionIntegrationTest, UnsignaledSsrcGetSourcesVideo) {
EXPECT_EQ(webrtc::RtpSourceType::SSRC, sources[0].source_type());
}
// Similar to the above test, except instead of waiting until GetSources() is
// non-empty we wait until media is flowing and then assert that GetSources()
// is not empty. This provides test coverage for https://crbug.com/webrtc/14817
// where a race due to the re-creationg of the unsignaled ssrc stream would
// clear the GetSources() history. This test not flaking confirms the bug fix.
TEST_P(PeerConnectionIntegrationTest,
UnsignaledSsrcGetSourcesNonEmptyIfMediaFlowing) {
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
caller()->AddVideoTrack();
callee()->SetReceivedSdpMunger(RemoveSsrcsAndMsids);
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
// Wait for one video frame to be received by the callee.
MediaExpectations media_expectations;
media_expectations.CalleeExpectsSomeVideo(1);
ASSERT_TRUE(ExpectNewFrames(media_expectations));
ASSERT_EQ(callee()->pc()->GetReceivers().size(), 1u);
auto receiver = callee()->pc()->GetReceivers()[0];
std::vector<RtpSource> sources = receiver->GetSources();
// SSRC history must not be cleared since the reception of the first frame.
ASSERT_GT(sources.size(), 0u);
EXPECT_EQ(webrtc::RtpSourceType::SSRC, sources[0].source_type());
}
TEST_P(PeerConnectionIntegrationTest, UnsignaledSsrcGetParametersAudio) {
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();