Calls: the window's own report carries the host load, and the native gate allows for the app's own level (spec 15.30)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+14
−4
native/apple/Sources/CallsKit/Call.swift+5 −1test/browser/native.mjs+9 −3
CI failed — run details
diff --git a/native/apple/Sources/CallsKit/Call.swift b/native/apple/Sources/CallsKit/Call.swift| index 39a1b61..44cb5a1 100644 |
| --- a/native/apple/Sources/CallsKit/Call.swift |
| +++ b/native/apple/Sources/CallsKit/Call.swift |
| @@ -1440,6 +1440,8 @@ private final class Events: NSObject, BridgeListenerProtocol { |
| // they cannot hear you yet, and how many this app reports it hears. |
| values["connectingJoining"] = UInt64(connectingWatch.joining.count) |
| values["connectingShown"] = UInt64(connectingPeers.count) |
| + // §15.30: the level this device's own trouble holds its camera at. |
| + values["ownCameraLevel"] = UInt64(ownCameraLevel.rawValue) |
| values["hearing"] = UInt64(reportedHearing.count) |
| // This app's own screen, as it leaves: the slowest connection's. |
| if let screen = screenReport { |
| @@ -1704,9 +1706,11 @@ extension Call { |
| /// its reference. |
| private func sendQualityWindow(samples: [String: QualityPeerSample], client: BridgeClient) { |
| let now = ProcessInfo.processInfo.systemUptime |
| - let report = qualityBuilder.build( |
| + var report = qualityBuilder.build( |
| at: now, samples: samples, events: &qualityTally, client: QualityClientInfo.current(), |
| devices: qualityDevices(), final: false, screenMode: sharingScreen ? screenMode.rawValue : nil) |
| + // §15.30 (2026-10-29): how this machine fared over the window. |
| + report.host = hostSampler.take(HostLoadSampler.Reading.now(at: now)) |
| let facts = QualityTrouble.facts(report) |
| let trigger = AutoReportDecision.trigger( |
| previous: qualityFacts, now: facts, gate: autoReportGate, at: now, enabled: QualityReporting.enabled(), |
diff --git a/test/browser/native.mjs b/test/browser/native.mjs| index 0e9a5ca..4069def 100644 |
| --- a/test/browser/native.mjs |
| +++ b/test/browser/native.mjs |
| @@ -276,12 +276,16 @@ try { |
| el.dispatchEvent(new Event('change', { bubbles: true })); |
| }, value); |
| }; |
| + // What the app sends when nothing is asked of it, unless its own |
| + // watch holds its camera down (a busy gate machine: §15.30's sender |
| + // half, which the app reports as ownCameraLevel). |
| const full = (await arriving()).height; |
| - assert.ok(full > 180, `the app's camera arrives above 180 lines before anything is asked (${full})`); |
| + console.log(`the app's camera arrives at ${full} lines before anything is asked; its own level ${sample?.stats.ownCameraLevel}`); |
| await pick('low'); |
| await wait(async () => (await arriving()).height > 0 && (await arriving()).height <= 180, |
| 'the app sends its camera at 180 lines or fewer when the browser asks for minimal', 20); |
| - console.log(`PASS the app applies a requested level: its camera arrives at ${(await arriving()).height} lines, from ${full}`); |
| + const low = (await arriving()).height; |
| + console.log(`PASS the app applies a requested level: its camera arrives at ${low} lines, from ${full}`); |
| await pick('audio'); |
| await new Promise(r => setTimeout(r, 3000)); |
| const paused = (await arriving()).bytes; |
| @@ -290,7 +294,9 @@ try { |
| await wait(() => sample?.stats.audioBytesReceived > 0, 'audio still arrives at the app'); |
| console.log('PASS the app pauses its camera for a browser on Audio only, and audio carries on'); |
| await pick('auto'); |
| - await wait(async () => (await arriving()).height > 180, 'the app sends full video again once the browser is back on Auto', 20); |
| + // Back to what it sent before anything was asked, or more. |
| + await wait(async () => (await arriving()).height >= Math.min(full, 181) && (await arriving()).height > 0, |
| + 'the app sends its camera as before once the browser is back on Auto', 20); |
| assert.equal(sample.stats.peerConnections, 1, 'changing levels keeps the same peer connection'); |
| console.log('PASS the app goes back to full video for Auto, on the same connection'); |
| } |