Repository navigation
fix(display): the master-refusal latch does not outlive the output format it describes - #589
Merged
Merged
Conversation
…rmat it describes `panelRefusedHDRMaster` recorded that AVFoundation refused an HDR master and kept that answer for the life of the process. The answer is about an output CONFIGURATION, not about a panel, and the user changes the configuration in Settings, which the platform never reports. A latch taken in a mode that genuinely refused therefore routed every HDR title media-direct long after the mode was changed back, on a box that can hold one app process for days. Measured by classicjazz on #459: two Apple TVs with identical panel readouts, one serving the master and one not, three of the four terms in `sessionRoutesAsHDRPanel` equal across the runs, and a force-quit curing the second box on the same file and the same television. The cost was booked as "the master route until the app restarts". It is larger than that and all of it is user-visible: the label reads SDR for every title, a Profile 7 source builds its supplemental descriptor and then has no variant to carry it, and no master means no TYPE=SUBTITLES rendition, so bitmap subtitles vanish from PiP while the overlay keeps publishing cues to a window nobody sees. Reaching the output format means leaving the app, so a real return from the background is the one event guaranteed to follow the change, and the engine already observes it. Read before the flag is cleared, so an activation that never backgrounded (a system alert, a volume HUD) does not spend the fallback for nothing. A panel that still refuses re-earns the latch at the next HDR load for one in-place media fallback, 223 ms with no visible black frame. Not keyed to a fingerprint of the display configuration, which would be more precise: the latch can only be set while `eligibleForHDRPlayback` is true, so the capability table at refusal time may be identical to the table afterwards, and a fingerprint built on that assumption would hold the stale latch silently. Re #588, reported on #459. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_014AVNwe8YDG9EQM7uHdjT3f
4 tasks done
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.
The master-refusal latch now has an expiry event.
panelRefusedHDRMasteranswers a question about an output CONFIGURATION, not about a panel. The user changes that configuration in Settings, the platform reports nothing when they do, and an Apple TV holds one app process for days, so a latch taken in a mode that genuinely refused kept routing every HDR title media-direct long after the mode was changed back.Reaching the output format means leaving the app, so a real return from the background is the one event guaranteed to follow the change, and
setupLifecycleObserversalready watches it. The flag is read before it is cleared, so an activation that never backgrounded (a system alert, a volume HUD) is not mistaken for a trip to Settings.Why this was worth more than the route
The latch's own comment weighed it against "the master route until the app restarts". classicjazz's measurements on #459 show the bill is larger and every item is visible to the viewer:
EXT-X-MEDIA:TYPE=SUBTITLESrendition, so bitmap subtitles disappear from PiP while the overlay keeps publishing cues to a window nobody can see.On the reporter's hardware the headroom leg is dead (
currentEDR=1.00 potentialEDR=1.00, and the explicit probe reportsno HDR reading in 12158ms), so losing the master route there is not losing one of two paths to the answer, it is losing the answer.What a wrong clear costs
One in-place media fallback, measured at 223 ms with no visible black frame, paid at the next HDR load after a foregrounding rather than once per process. The latch keeps its whole job inside a viewing session, which is where the per-title repetition it exists to prevent would actually have happened.
What this deliberately does not do
Key the latch to a fingerprint of the display configuration. That would be more precise, but the latch can only be set while
eligibleForHDRPlaybackis true, so the capability table at refusal time may be identical to the table afterwards, and a fingerprint built on that assumption would hold the stale latch silently. That needs measuring on the device before anything is built on it. The background return needs no such assumption.Tests
Issue588RefusalLatchLifetimeTests, four cases: the latch does not survive a return, the reporter's route recovers without a restart, clearing an unset latch is a no-op, and the observer acts only on a real background return (a source-level check, because a policy test cannot see a notification).Full suite green, both runners, exit 0: 3306 swift-testing cases in 443 suites, 642 XCTest cases.
xcodebuild -scheme AetherEngine -destination 'generic/platform=tvOS'builds, which is the platform the changed observer actually compiles on.Device verification is still open: the shape that needs a television is refusing a master, changing the output format back, leaving the app and returning, and seeing the master served without a force-quit.
Re #588, reported on #459.
🤖 Generated with Claude Code
https://claude.ai/code/session_014AVNwe8YDG9EQM7uHdjT3f