Repository navigation
Description
Part of #1751.
Scope
The simulator capture decides on the 60 fps grid before it copies a composite, copies on a queue of its own, and every frame carries the time its composite was seen, on the simulator and the iPhone source. After this PR the about four in ten copies the encode loop used to throw away are no longer made, and a slow copy no longer shifts which frames are kept.
If it goes wrong: the stream gets fewer frames a second than today, or a still screen's idle-floor picture stops arriving.
Technical spec
Commit fb42676.
Rows
Behaviours: B1, B2, B3
Interfaces: I1, I5, I6, I7, I8
Existing code: X1, X2, X3, X6, X7, X8, X9, X10
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 | The test target can import the simulator program's types (@testable import), as the panel tests do |
vendor/screen-capture/Package.swift:50-54 |
Modules touched
vendor/screen-capture/Sources/SimlockCapture/ (new FrameGrid.swift, Lifecycle.swift, Options.swift), vendor/screen-capture/Sources/simlock-screen-capture/ (new FrameSelection.swift, FrameCapture.swift, SimulatorSource.swift, main.swift), vendor/screen-capture/Sources/simlock-device-capture/DeviceScreenSource.swift, vendor/screen-capture/NOTICE.md (its file table and a new entry under Deviations, NOTICE.md:113), vendor/screen-capture/Package.swift:10-21 (its "two changes" comment), docs/internal/VENDORED-CODE.md. Searches: onFrame in Sources/ (14), atNanos (7), photocopier.copy (1), SimulatorSource( (1).
Rules in play
vendor-and-third-party-code.md:FrameCapture.swiftgets aMODIFIED FILEheader naming the notice/copy split;NOTICE.mdand theVENDORED-CODE.mdserve-sim row say "modified by us" and listFrameGrid.swiftandFrameSelection.swiftas ours, MIT.testing.md: one table test per Behaviours row, at the seams the rows name.
Retired words
one patch:FrameCapture.swiftis "modified by us" inNOTICE.mdandVENDORED-CODE.md.
Tests
Seam: FrameGrid, FrameSelection and encodeLoop in SimlockCaptureTests, modelled on vendor/screen-capture/Tests/SimlockCaptureTests/EncodeLoopTests.swift; the TypeScript side is src/drivers/ios/screen-capture.test.ts, which starts these programs and must keep passing.
- B1: the encode loop keeps frames on the grid through
FrameGrid: the four fix(capture): a source of at least --fps is written at --fps #1718 cases;isDueasked twice moves nothing;committhenisDue5 ms later is not due. - B2: the capture decides before it copies: 100/s for 2 s at fps 60 gives 120 copied; 30/s gives 60; forced 200 ms after: copied, grid moves; forced 5 ms after: copied, grid does not move; a new picture size: copied.
- B3: frames the capture copies are written by the encode loop:
pendingcalled late keeps the seen time; the B2 cases written equal copied, except the forced one under one interval.
Done when
swift test --package-path vendor/screen-capturepasses, the fix(capture): a source of at least --fps is written at --fps #1718 cases inEncodeLoopTestsamong them.pnpm buildbuildsdist/bin/simlock-screen-captureanddist/bin/simlock-device-capture.
Out of scope
The 1 ms seed check (#1753), tile selection and the measurement (#1754).
Depends on
Written by an agent.
Activity
test: frames the capture copies are written by the encode loop (#1752)
test: the copy stage decides before it copies; NOTICE counts the Fram…
feat(screen-capture): the simulator capture decides on the 60 fps gri…