Repository navigation
osc.lua: don’t re-render for time and cache updates while hidden - #18914
Open
paulmenzel wants to merge 1 commit into
Open
paulmenzel wants to merge 1 commit into
paulmenzel wants to merge 1 commit into
Conversation
playback-time changes on every video frame and demuxer-cache-state on
nearly every packet. Both requested a tick, so the OSC ran render()
about 30 times per second (rate-limited by tick_delay) even when none of
it was on screen: it fetched the mouse position, reset the mouse areas
and built an empty ASS string.
Now these two properties only request a tick while the OSC or the window
controls are visible or animating. Showing the OSC requests a tick on
its own, and render_elements() reads the current values then. The other
observed properties still request ticks unconditionally.
render() calls (msg.trace "rendering"), Big Buck Bunny 1080p30 H.264,
fullscreen, osc-visibility switched over IPC:
before after
hidden (auto) 31.0/s 2.5/s
visible (always) 33.9/s 33.7/s
Cycles over 40 s of playback, mean of 3 interleaved runs, Dell XPS 13
9310 (i7-1165G7), Debian sid, GNOME Wayland, mpv 0.42.0, FFmpeg 9.0.2,
libplacebo 7.387, --hwdec=auto-safe, both variants loaded with
--no-osc --script=osc.lua:
before after
mpv process 5.39 G 5.20 G (-3.5 %)
Author
|
Assisted-by: claude-opus-5.5 |
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.
While hidden, the OSC still re-rendered about 30 times per second, because playback-time and demuxer-cache-state requested a tick on every change. Now these two request a tick only while the OSC or the window controls are visible or animating. Showing the OSC requests a tick itself, so the shown values are current.
Tested with the patched osc.lua loaded via --script into mpv 0.42.0 (Debian sid, GNOME Wayland): render calls while hidden drop from 31/s to 2.5/s and are unchanged while visible; mpv’s own cycles drop 3.5 % with --hwdec=auto-safe. luacheck is clean.