Skip to content

The simulator capture copies only composites that carry a new app frame, measured with a counter app #1754

Closed

Description

@V3RON

Part of #1751.

Scope

The simulator capture hashes each composite it takes in tiles and copies a due one only when it carries a new app frame, so the Liquid Glass changing on every composite no longer makes the stream repeat and skip app frames. This PR also adds the counter app and reader and posts the measurement that closes the feature.

If it goes wrong: a small animation stutters for up to 1.5 frame intervals, or the stream repeats frames as today.

Technical spec

Commit fb42676.

Rows

Behaviours: B5, B6
Interfaces: I2, I4, I9
Existing code: X3, X11

Facts

# Fact Source
F1 The Swift tests are the SimlockCaptureTests target, run with swift test --package-path vendor/screen-capture on a Mac with Xcode vendor/screen-capture/Package.swift:50-55, docs/internal/agent-rules/toolchain.md:171-172
F2 unframe.mjs reads the capture's framed output (tags 1-5) and is the model for the reader's parser vendor/screen-capture/scripts/unframe.mjs:16-30
F3 This Mac has ffmpeg, Xcode and an iOS 26 runtime which ffmpeg printed /opt/homebrew/bin/ffmpeg; xcodebuild -version printed Xcode 27.2; xcrun simctl list runtimes printed iOS 26.4 (26.4.1 - 23E254a)

Modules touched

vendor/screen-capture/Sources/simlock-screen-capture/ (FrameSelection.swift, FrameCapture.swift), vendor/screen-capture/scripts/ (new fps-counter/, fps-reader.mjs), vendor/screen-capture/NOTICE.md (rows for scripts/fps-counter/ and scripts/fps-reader.mjs beside scripts/unframe.mjs at NOTICE.md:69). Searches: photocopier.copy (1), scripts/ under vendor/screen-capture (1 file).

Rules in play

Tests

Seam: TileSelector and FrameSelection with tiles in SimlockCaptureTests, modelled on vendor/screen-capture/Tests/SimlockCaptureTests/EncodeLoopTests.swift; the TypeScript side is src/source-hygiene.repo.test.ts, which must accept the new scripts.

  • B5: a due composite is copied only with a new app frame: only always-changing tiles 10 ms after, skipped, then a steady change 4 ms later copied; a steady tile changed, copied; half the sometimes-changing changed, copied; under half, skipped; only always-changing 13 ms after, copied; 26 ms since the last sent, copied; nothing changed 5 ms after, skipped; first composite, copied; new size, copied and history cleared; forced, copied; the scroll pattern, every due block change copied.
  • B6: the reader on this Mac (hardware, once): scroll and animation at fps 60 with the capture built at fb4267632, then at this PR's head; ffmpeg missing exits 1 with ffmpeg not found. Also: Seed check cost: the CPU condition stands, and the 1 ms seed check (The simulator capture's seed skip moves into SeedGate (the 1 ms seed check is dropped) #1753) gives way to it. No interval of 1, 2, 4 or 8 ms kept cpu at or below before (measured on feat(screen-capture): the simulator capture copies only composites that carry a new app frame #1773), so SeedWatch is removed from the stack, in The simulator capture's seed skip moves into SeedGate (the 1 ms seed check is dropped) #1753's own PR, and the callback alone notices composites. Tests: the B6 run per interval, posted in the PR body (decided in delivery, approved by the maintainer 2026-11-19) Also: P95 where before is already over: when the before build's p95 on a scenario is above 20 ms on this Mac, that scenario's p95 condition is "no higher than before" instead of "at most 20 ms"; before and after are measured back to back, three 20 s runs each, and compared by their medians. Tests: the B6 run, three before and three after lines per scenario and their medians, posted in the PR body (decided in delivery, approved by the maintainer 2026-11-19)

Done when

  • swift test --package-path vendor/screen-capture passes.
  • pnpm exec vitest run --project unit src/source-hygiene.repo.test.ts passes.
  • Hardware, once on this Mac (no slow-lane test), on an iPhone 17 Pro simulator with an iOS 26 runtime (26.4, or 26.5 when 26.4 is not installed), both named in the PR body: the PR body holds the reader's lines for both scenarios before and after, and after shows distinct/s at least 58, p95 at most 20 ms (or, on a scenario whose before p95 is over 20 ms, no higher than before, by medians of three back-to-back runs each) and cpu at most 1 point above before, by medians of three back-to-back runs (approved by the maintainer 2026-11-19).

Out of scope

NV12, the alive tag, the frame trace (#1751 Non-goals).

Depends on

Written by an agent.

Activity

  1. added
    task:draft
    on Nov 19, 2026
  2. added
    task:ready
    and removed
    task:draft
    on Nov 19, 2026
  3. self-assigned this
    on Nov 19, 2026
  4. 10 remaining items

  5. self-assigned this
    on Nov 19, 2026
  6. V3RON commented on Nov 19, 2026

    @V3RON
    ContributorAuthor

    Handoff

    Done: #1753 fix: SeedWatch removed in #1771 (fix-check passed, body and title updated); stack synced. #1773: stack merge, audit (dead TileSelector counter removed), review round 1 and fix-check passed at 10bf2f7d. Hardware-fix 2fdf6907 hashes every 8th row and every 2nd pixel.

    Not done: Done when line 3; fix-check of 2fdf6907; PR body ticks; ready.

    Findings: verifier run 2 on iOS 26.4 (table in #1773's body): distinct/s and p95 pass on both scenarios. cpu after is above before in all six alternating pairs: medians +0.6 (scroll), +0.3 (animation), inside the ~1.5-point run spread. Tile hashing cannot cost zero, so "no higher" fails on every head so far.

    Blocked on: the maintainer: accept a cpu margin (for example within 1 point by medians), or name another target.

    Written by an agent.

  7. added
    task:blocked
    on Nov 19, 2026
  8. removed their assignment
    on Nov 19, 2026
  9. removed
    task:draft
    on Nov 19, 2026
  10. added
    task:ready
    and removed
    task:blocked
    on Nov 19, 2026
  11. self-assigned this
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

task:ready

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions