Repository navigation
Description
Part of #602.
Scope
After this PR an iOS simulator's or an iPhone's stream sends a key frame at least every 5 seconds, also while the screen is still. A viewer that resets its decoder, or that later joins a shared capture, gets a picture within 5 s.
If it goes wrong: a still simulator's stream shows a picture late to a new decoder, or a moving picture gets noticeably softer.
Technical spec
Commit 5e639b4.
Rows
- Behaviours: B1, B2
- Interfaces: I3
- Existing code: X10, X11, X14 (the iOS manual's line)
Facts
| # | Fact | Source |
|---|---|---|
| F1 | The Swift tests are the package's test target, run with swift test --package-path vendor/screen-capture on a Mac with Xcode. |
vendor/screen-capture/Package.swift:50, docs/internal/agent-rules/toolchain.md:170-171 |
| F2 | The existing encode-loop test feeds Pending(buffer:atNanos:) frames and reads what Wire.sink receives. |
vendor/screen-capture/Tests/SimlockCaptureTests/EncodeLoopTests.swift:17-30 |
| F3 | The slow iOS stream test reads frames through readScreenFrames. |
e2e/helpers/screen-frames.ts:14, e2e/slow-ios-stream.test.ts:63 |
Modules touched
vendor/screen-capture/Sources/SimlockCapture (Lifecycle.swift), its tests, e2e/slow-ios-stream.test.ts, src/drivers/ios/AGENTS.md. Searches: forceKeyframe, MaxKeyFrameInterval, encodeLoop.
Rules in play
- ADR 0079 §5: the key-frame bound on iOS, in the shared encode loop, so the simulator and the iPhone get it alike.
- ADR 0075 §3: a size change still writes meta, then fresh parameter sets and a key frame; the existing test stays green.
docs/internal/agent-rules/toolchain.md(screen capture): a change to the Swift program is checked byswift testand on a real simulator.
Tests
The seam is encodeLoop, driven like vendor/screen-capture/Tests/SimlockCaptureTests/EncodeLoopTests.swift, with fake frames and Wire.sink; B2 adds a case to e2e/slow-ios-stream.test.ts.
- B1: an iOS capture given frames writes a key frame at least every 5 s of frame time: idle-floor frames (5/s) for 12 s; 30 frames/s for 12 s; a size change at 3 s (its key frame) moves the next forced one to 8 s; a size change still gets meta, parameter sets and a key frame.
- B2: a viewer of a still iOS simulator gets a key frame at least every 5 s: a still home screen for 15 s gives at least 3 key frames, with no gap over 5.5 s (slow lane).
- B3:
src/docs-manuals.test.tspasses with the iOS manual's Screen rule naming the periodic key frame: no copied value, the manual within 8000 characters and all manuals within 140000. (decided in delivery, pending the maintainer)
Done when
swift test --package-path vendor/screen-capturepasses with the B1 cases.- Slow lane:
scripts/slow-e2e.sh e2e/slow-ios-stream.test.tspasses with the B2 case, on a real simulator. src/drivers/ios/AGENTS.md's Screen rule says the capture writes a key frame on a fixed period of arrival time, a still screen included, without stating the period (documentation rule 7; the number lives in the code and ADR 0079). (decided in delivery, pending the maintainer)
Out of scope
- Sharing a capture between viewers: One capture per lease, shared by every viewer of its screen #602's other tasks.
Depends on
Written by an agent.
Activity
V3RON commentedon Nov 16, 2026
Handoff
Done: #1606 is built and audited. The B1 Swift test is green, and the iOS manual's Screen rule is updated. Review round 1 on 6efb3de (spec, code and claims lenses) found nothing. The PR is ready, in the #602 stack above #1593, and labelled
needs-hardware.Not done: Done when line 2, the slow-lane B2 case (
scripts/slow-e2e.sh e2e/slow-ios-stream.test.tson a real simulator). The lane's check refused to run it: 5.5 GiB free on disk, and it needs 15.Findings: none.
Blocked on: someone runs the slow lane on a machine with 15 GiB free (
/verify-hardware 1606), ticks line 2, and removesneeds-hardware. The PR then waits for the stack to merge.Written by an agent.
github-actions commentedon Nov 16, 2026
Back to
task:draft:.agents/scripts/spec-lint.mjsfound blocking lines. Fix them in the body, then settask:readyagain.docs(ios): the Screen rule names the key frame without a number (#1600)
github-actions commentedon Nov 16, 2026
Back to
task:draft:.agents/scripts/spec-lint.mjsfound blocking lines. Fix them in the body, then settask:readyagain.feat(screen-capture): iOS screen streams send a key frame at least ev…