Skip to content

Commit

Permalink
Prevent timeout when remote stats are not implemented
Browse files Browse the repository at this point in the history
This prevents a failure in RTCP messsaging from masking
other failures. It's up to other tests to actually
verify that RTCP stats have been delivered.

Bug: 904574
Change-Id: Ie641d5275372b4c10ad5fa3a39ae38c36f974482
  • Loading branch information
alvestrand authored and chromium-wpt-export-bot committed Nov 19, 2018
1 parent adc866b commit f3508ae
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions webrtc/RTCPeerConnection-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ function createDataChannelPair(

// Wait for RTP and RTCP stats to arrive
async function waitForRtpAndRtcpStats(pc) {
// If remote stats are never reported, return after 5 seconds.
const startTime = performance.now();
while (true) {
const report = await pc.getStats();
const stats = [...report.values()].filter(({type}) => type.endsWith("bound-rtp"));
Expand All @@ -259,6 +261,9 @@ async function waitForRtpAndRtcpStats(pc) {
if (stats.length && stats.every(({localId, remoteId}) => localId || remoteId)) {
break;
}
if (performance.now() > startTime + 5000) {
break;
}
}
}

Expand Down

0 comments on commit f3508ae

Please sign in to comment.