Skip to content

Commit

Permalink
Deflake RTCStatsIntegrationTest::GetStatsFromCallee
Browse files Browse the repository at this point in the history
The test may sometimes fail because the round trip time has not been
estimated. Wait until the report contains the round trip time before
proceeding, or fail after 10 s.

Fixed: webrtc:14952
Change-Id: I9127b8ee6afa7454d061de96f002422d7d4af428
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/295724
Commit-Queue: Johannes Kron <kron@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39438}
  • Loading branch information
Johannes Kron authored and WebRTC LUCI CQ committed Mar 1, 2023
1 parent cec9d00 commit bff2e27
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pc/rtc_stats_integrationtest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,17 @@ TEST_F(RTCStatsIntegrationTest, GetStatsFromCaller) {
TEST_F(RTCStatsIntegrationTest, GetStatsFromCallee) {
StartCall();

rtc::scoped_refptr<const RTCStatsReport> report = GetStatsFromCallee();
rtc::scoped_refptr<const RTCStatsReport> report;
// Wait for round trip time measurements to be defined.
constexpr int kMaxWaitMs = 10000;
auto GetStatsReportAndReturnTrueIfRttIsDefined = [&report, this] {
report = GetStatsFromCallee();
auto inbound_stats =
report->GetStatsOfType<RTCRemoteInboundRtpStreamStats>();
return !inbound_stats.empty() &&
inbound_stats.front()->round_trip_time_measurements.is_defined();
};
EXPECT_TRUE_WAIT(GetStatsReportAndReturnTrueIfRttIsDefined(), kMaxWaitMs);
RTCStatsReportVerifier(report.get()).VerifyReport({});

#if RTC_TRACE_EVENTS_ENABLED
Expand Down

0 comments on commit bff2e27

Please sign in to comment.