From 90e080d075295cb46677fff7209a01b01db6981b Mon Sep 17 00:00:00 2001 From: Jeremy Leconte Date: Fri, 13 Dec 2024 11:41:07 +0100 Subject: [PATCH] Fix tsan issue with PeerConnectionCongestionControlTest. https://ci.chromium.org/ui/p/webrtc/builders/ci/Linux%20Tsan%20v2/34967/overview Change-Id: I88b68a0513af211d878f08aec8dd24b72b729db4 Bug: None Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/371460 Commit-Queue: Jeremy Leconte Reviewed-by: Harald Alvestrand Cr-Commit-Position: refs/heads/main@{#43559} --- pc/congestion_control_integrationtest.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pc/congestion_control_integrationtest.cc b/pc/congestion_control_integrationtest.cc index 0986a2d20c..c73cb2d1ed 100644 --- a/pc/congestion_control_integrationtest.cc +++ b/pc/congestion_control_integrationtest.cc @@ -42,6 +42,9 @@ TEST_F(PeerConnectionCongestionControlTest, OfferContainsCcfbIfEnabled) { auto offer = caller()->CreateOfferAndWait(); std::string offer_str = absl::StrCat(*offer); EXPECT_THAT(offer_str, HasSubstr("a=rtcp-fb:* ack ccfb\r\n")); + // Closing peer connections before ScopedFieldTrials gets out of scope to + // avoid a race condition. + ClosePeerConnections(); } TEST_F(PeerConnectionCongestionControlTest, ReceiveOfferSetsCcfbFlag) { @@ -69,6 +72,9 @@ TEST_F(PeerConnectionCongestionControlTest, ReceiveOfferSetsCcfbFlag) { // Check that the answer does not contain transport-cc std::string answer_str = absl::StrCat(*caller()->pc()->remote_description()); EXPECT_THAT(answer_str, Not(HasSubstr("transport-cc"))); + // Closing peer connections before ScopedFieldTrials gets out of scope to + // avoid a race condition. + ClosePeerConnections(); } TEST_F(PeerConnectionCongestionControlTest, CcfbGetsUsed) { @@ -89,6 +95,9 @@ TEST_F(PeerConnectionCongestionControlTest, CcfbGetsUsed) { // There should be no transport-cc generated. EXPECT_THAT(pc_internal->FeedbackAccordingToTransportCcCountForTesting(), Eq(0)); + // Closing peer connections before ScopedFieldTrials gets out of scope to + // avoid a race condition. + ClosePeerConnections(); } TEST_F(PeerConnectionCongestionControlTest, TransportCcGetsUsed) { @@ -109,6 +118,9 @@ TEST_F(PeerConnectionCongestionControlTest, TransportCcGetsUsed) { kDefaultTimeout); // Test that RFC 8888 feedback is NOT generated when field trial disabled. EXPECT_THAT(pc_internal->FeedbackAccordingToRfc8888CountForTesting(), Eq(0)); + // Closing peer connections before ScopedFieldTrials gets out of scope to + // avoid a race condition. + ClosePeerConnections(); } } // namespace webrtc