oficina / meet Public

Calls: the lowbandwidth gate counts the climb from the last second that was not clean (spec 15.30)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 665dea0f6a3390d3f55ee62b86e39af22f5373fb parent de278b5
1 file changed, +12 −7
  • test/browser/call.mjs +12 −7
diff --git a/test/browser/call.mjs b/test/browser/call.mjs
index d7f302e..2bbe12e 100644
--- a/test/browser/call.mjs
+++ b/test/browser/call.mjs
@@ -6814,8 +6814,9 @@ const run = {
const hears = await pageB.evaluate((id) => window.meet.state().hearingList.includes(id), a);
check(hears, 'B still hears A');
// Lift the cap: the first step up on the real wait, counted from the
- // last step down — at audio only nothing arrives to suffer, so every
- // second from there is clean, cap or none.
+ // last step down or the last second that was not clean since, whichever
+ // is later — at audio only nothing arrives to suffer, and a headless
+ // freeze at minimal starts the clean run again, as it should.
await pageB.evaluate(() => window.__capDownlink(0));
const levels = ['normal', 'reduced', 'minimal', 'audio'];
const from = (await look('lifted')).row.bAsks;
@@ -6823,16 +6824,20 @@ const run = {
for (let i = 1; i < timeline.length; i++) {
if (levels.indexOf(timeline[i].bAsks) > levels.indexOf(timeline[i - 1].bAsks)) lastDown = timeline[i].t;
}
+ const unclean = (x) => !!x && (x.freezes > 0 || x.freezeSeconds > 0 || x.keyframeAsks > 0 || x.load ||
+ (x.packets + x.lost > 0 && x.lost / (x.packets + x.lost) > 0.02) || (x.rtt !== null && x.rtt >= 400));
+ const quietFrom = () => timeline.reduce((m, r) => (r.t > lastDown && unclean(r.bLast) ? Math.max(m, r.t) : m), lastDown);
let up = null;
- while (!up && (Date.now() - t0) / 1000 - lastDown < 70) {
+ while (!up && (Date.now() - t0) / 1000 - quietFrom() < 70) {
await sleep(1000);
const { row } = await look('lifted');
if (row.bAsks !== from) up = row;
}
- const upAfter = up ? up.t - lastDown : -1;
- check(up && levels.indexOf(up.bAsks) === levels.indexOf(from) - 1 && upAfter >= 44 && upAfter <= 62,
- 'B steps A’s video up one level 45–60 s after its last step down (' + from + ' -> ' + (up && up.bAsks) +
- ' ' + upAfter + ' s after the step at ' + lastDown + ' s)');
+ const since = quietFrom();
+ const upAfter = up ? up.t - since : -1;
+ check(up && levels.indexOf(up.bAsks) === levels.indexOf(from) - 1 && upAfter >= 43 && upAfter <= 62,
+ 'B steps A’s video up one level 45–60 s after its last step down or trouble (' + from + ' -> ' + (up && up.bAsks) +
+ ' ' + upAfter + ' s after ' + since + ' s; last step down at ' + lastDown + ' s)');
// The rest on a shortened wait, all the way back to normal.
await pageB.evaluate(() => window.meet.adaptForTest({ upAfter: 4000 }));
const normal = await until(async () => {