Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gecko Bug 1834369] Relax target values to improve test performance on slower machines. #40214

Merged
merged 1 commit into from
May 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 14 additions & 8 deletions webrtc-extensions/RTCRtpReceiver-jitterBufferTarget-stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
"measure raising video jitterBufferTarget to 500");
async_promise_test(t => applyJitterBufferTarget(t, "audio", 500),
"measure raising audio jitterBufferTarget to 500");
async_promise_test(t => applyJitterBufferTarget(t, "video", 250, 50),
"measure lowering video jitterBufferTarget to 50");
async_promise_test(t => applyJitterBufferTarget(t, "audio", 250, 50),
"measure lowering audio jitterBufferTarget to 50");
async_promise_test(t => applyJitterBufferTarget(t, "video", 500, 150),
async_promise_test(t => applyJitterBufferTarget(t, "video", 250, 150),
"measure lowering video jitterBufferTarget to 150");
async_promise_test(t => applyJitterBufferTarget(t, "audio", 500, 150),
async_promise_test(t => applyJitterBufferTarget(t, "audio", 250, 150),
"measure lowering audio jitterBufferTarget to 150");
async_promise_test(t => applyJitterBufferTarget(t, "video", 400, 250),
"measure lowering video jitterBufferTarget to 300");
async_promise_test(t => applyJitterBufferTarget(t, "audio", 400, 250),
"measure lowering audio jitterBufferTarget to 300");

async function applyJitterBufferTarget(t, kind, target, targetToLower) {
const caller = new RTCPeerConnection();
Expand Down Expand Up @@ -67,7 +67,8 @@
async function measureDelayFromStats(t, receiver, callee, target, kind) {
const lowerBound = target * 0.7;
const upperBound = target * 1.3;
let delay, oldInboundStats;
let delay, oldInboundStats, prevDelay, rateOfChange;
let numDelayMeasurements = 1;

for (let statChecks = 0; statChecks < 40; statChecks++) {
await new Promise(r => t.step_timeout(r, 1000));
Expand All @@ -77,14 +78,19 @@
if (oldInboundStats) {
delay = ((inboundStats.jitterBufferDelay - oldInboundStats.jitterBufferDelay) /
(inboundStats.jitterBufferEmittedCount - oldInboundStats.jitterBufferEmittedCount) * 1000);
if (prevDelay) {
rateOfChange = (delay - prevDelay) / numDelayMeasurements;
numDelayMeasurements++;
}
prevDelay = delay;
if (delay > lowerBound && delay < upperBound) {
break;
}
}
oldInboundStats = inboundStats;
}
t.step(() => assert_between_inclusive(delay , lowerBound, upperBound,
`${kind} delay is within bounds`));
`${kind} delay is within bounds rateOfChange ${rateOfChange} over ${numDelayMeasurements} measurements`));
return delay;
}
</script>
Expand Down