Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Same-title custom-disc reloads can discard verified progressive evidence and unnecessarily start hardware warm-up.
1 open issue
What changed in this PR
This PR makes hardware deinterlace warm-up demand-driven, avoiding unnecessary Metal/VideoToolbox setup during engine construction and progressive software playback.
Changes:
- Start one shared warm-up task only for potentially interlaced auto-mode loads.
- Carry the warm-up decision through reloads, recompute it for disc-title overrides, and clear it on stop.
- Add routing, lazy-start, cancellation, and lifecycle coverage, with supporting documentation.
| File | Description |
|---|---|
| Tests/AetherEngineTests/VideoRoutingPolicyTests.swift | Tests warm-up eligibility across codecs and field orders. |
| Tests/AetherEngineTests/Issue232InterlaceProbeTests.swift | Tests load, reload, and stop decision state. |
| Tests/AetherEngineTests/Issue203SoftwareColdStartTests.swift | Tests lazy warm-up, shared demand, and skipped requests. |
| Sources/AetherEngine/Decoder/VideoRoutingPolicy.swift | Classifies sources that may need deinterlace warm-up. |
| Sources/AetherEngine/Decoder/DeinterlaceHardwareWarmup.swift | Lazily creates a lock-protected shared task. |
| Sources/AetherEngine/AetherEngine+Loading.swift | Gates warm-up and carries decisions through reloads. |
| Sources/AetherEngine/AetherEngine.swift | Removes construction-time warm-up and manages source decisions. |
| docs/architecture.md | Documents demand-driven warm-up and reload behavior. |
| CHANGELOG.md | Records the warm-up performance change. |
Review effort: Balanced
| } | ||
| } | ||
|
|
||
| let reopenedRequiresDeinterlaceWarmup: Bool = if discTitleIDOverride != nil, |
jonluca
force-pushed
the
perf/lazy-deinterlace-warmup
branch
from
October 25, 2026 18:29
890c14d to
3c1e9d0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Constructing an engine starts a process-wide hardware deinterlace warm-up, and every software load in auto mode waits for it. Progressive VP8/VP9/AV1 playback therefore builds and waits for a Metal/VideoToolbox graph it never uses.
Start the shared task on the first potentially interlaced auto-mode load. Concrete interlaced metadata qualifies for every codec; H.264's unknown field order consults its SPS, and unknown MPEG-2/MPEG-4/VC-1 sources remain conservative. Progressive sources and forced-software deinterlace skip warm-up.
Audio reloads preserve the decision. Disc-title switches recompute it from the reopened title, stop clears it, and the load generation is rechecked after the asynchronous gate. Concurrent waiters still share one task, and cancellation of one waiter does not cancel process-wide work.
Test plan
swift build --target AetherEngine -Xswiftc -warnings-as-errors --disable-automatic-resolution --jobs 4passes. Focused tests use the same isolated scratch directory and resolved pins.git diff --checkpass. Disc-title transition wiring was source-reviewed; a physical-disc title switch and iOS/tvOS runtime were not exercised.Checklist