fix(display): a frame the preview throttle skipped still reaches the snapshot - #752
Open
ChuckBuilds wants to merge 1 commit into
Open
ChuckBuilds wants to merge 1 commit into
ChuckBuilds wants to merge 1 commit into
Conversation
…snapshot The preview snapshot (/api/v3/display/current, the web UI's live preview) is written only from update_display(), at most once per write interval. A changed frame pushed inside that interval was skipped and left for the next update_display() -- which a screen that draws its card once and then holds it never makes. Soccer's recent/upcoming cards skip redundant redraws. After an on-demand start, the card is pushed a few milliseconds after the start's clear wrote a black frame, so the throttle skipped it and the preview stayed black for the whole 15 s screen while the panel showed the card. The next screen looked fine because its first push came after the interval had passed. DisplayManager now records a skipped changed frame as owed, and the render loop (_display_once) calls write_owed_snapshot() after each frame, which writes it once the interval has passed. The cadence is unchanged, an unchanged frame is never re-encoded, and nothing runs when no frame is owed. Golden run-loop traces are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 50 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 4 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
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.
Bug
On ledpi (main ef69201, soccer-scoreboard 2.39.2), starting soccer on-demand showed 0 lit pixels in
/api/v3/display/currentfor that mode's whole 15 s screen. The next on-demand screen rendered at once. Other plugins were not affected.Root cause (core, not soccer)
The panel showed the card. The preview snapshot did not.
DisplayManager.update_display(), at most once per write interval (snapshot_policy: 1 s with a viewer, 30 s without).clear()+update_display(), which writes a black frame.update_display(). The frame goes to the panel, but it lands inside the write interval, so the snapshot skips it.return True # Already showing this game). They make no furtherupdate_display()call for the rest of the screen, so the skipped frame is never written.The plugin's redraw skip is a legitimate draw-once-and-hold pattern (dirty tracking exists for it). The defect is that the preview depends on a later
update_display()call that may never happen.Fix
DisplayManager._write_snapshot_if_due()now records a changed frame it skipped as owed (_snapshot_owed).DisplayManager.write_owed_snapshot():_update_lock. The write still waits out the interval, and an unchanged frame is never re-encoded.DisplayController._display_once()calls it after each frame, guarded withgetattr. It covers both the 1 s and the high-FPS loops.Tests
test/test_snapshot_owed_frame.py(new) uses the real DisplayManager on the emulator plusDisplayController._display_once. It replays the case: clear, then a card drawn inside the interval, then a held frame that draws nothing.assert 0 > 0(snapshot black). 3 of its 5 tests fail there; all 5 pass with the fix.test_run_loop_goldenpasses and its fixtures are unchanged.Side note, not changed here: soccer's per-league modes (
soccer_esp.1_recent) try every enabled league's manager, not just the named one. On ledpi that mode showed the eng.1 card.🤖 Generated with Claude Code