Skip to content

iOS screen streams send a key frame at least every 5 s, still screens included #1600

Closed

Description

@V3RON

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 by swift test and 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.ts passes 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-capture passes with the B1 cases.
  • Slow lane: scripts/slow-e2e.sh e2e/slow-ios-stream.test.ts passes 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

Depends on

Written by an agent.

Activity

  1. added
    task:draft
    on Nov 16, 2026
  2. added
    task:ready
    and removed
    task:draft
    on Nov 16, 2026
  3. self-assigned this
    on Nov 16, 2026
  4. V3RON commented on Nov 16, 2026

    @V3RON
    ContributorAuthor

    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.ts on 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 removes needs-hardware. The PR then waits for the stack to merge.

    Written by an agent.

  5. added
    task:blocked
    and removed
    task:ready
    on Nov 16, 2026
  6. removed their assignment
    on Nov 16, 2026
  7. added
    task:ready
    and removed
    task:blocked
    on Nov 16, 2026
  8. self-assigned this
    on Nov 16, 2026
  9. added
    task:draft
    and removed
    task:ready
    on Nov 16, 2026
  10. github-actions commented on Nov 16, 2026

    @github-actions
    Contributor

    Back to task:draft: .agents/scripts/spec-lint.mjs found blocking lines. Fix them in the body, then set task:ready again.

    B 1600 Tests: line 3 names B3, which the parent does not give to #1600
    
  11. added
    task:blocked
    on Nov 16, 2026
  12. removed their assignment
    on Nov 16, 2026
  13. removed
    task:draft
    on Nov 16, 2026
  14. added
    task:ready
    and removed
    task:blocked
    on Nov 16, 2026
  15. self-assigned this
    on Nov 16, 2026
  16. added
    task:draft
    and removed
    task:ready
    on Nov 16, 2026
  17. github-actions commented on Nov 16, 2026

    @github-actions
    Contributor

    Back to task:draft: .agents/scripts/spec-lint.mjs found blocking lines. Fix them in the body, then set task:ready again.

    B 1600 Tests: line 3 names B3, which the parent does not give to #1600
    
  18. added a commit that references this issue on Nov 16, 2026
    e19088b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

task:draft

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions