Skip to content

frontend: VolumeMeter 60 Hz repaint timer never pauses (hidden, minimized or silent) #1281

Closed

Description

@zackees

Part of #1273. B, UI thread.

frontend/components/VolumeMeter.cpp.hpp:323-336: one shared Qt::PreciseTimer at 16 ms (~60 Hz) repaints every volume meter (update(getBarRect())) on the UI thread. It never stops or pauses: it keeps running while the mixer is hidden, OBS is minimized, or every source is silent. This is the largest steady UI-thread cost found.

(Related, smaller: frontend/components/MediaControls.cpp.hpp:179 runs a 16 ms slider timer, but only while media is playing, which is fine.)

Fix: stop the timer when no meter is visible (hidden dock, minimized window), and skip repaints for meters whose level and peak hold haven't changed; restart on the next level change.

Test: with the meters hidden, or all sources silent, the timer is inactive and there are no meter repaints over a few seconds.

Activity

  1. vpacher commented on Oct 17, 2026

    @vpacher
    Member

    Claiming: #1281

    Plan (one PR):

    1. RED: a C++ test on Qt's offscreen platform (like test_replay_buffer_estimate) for two pieces the widget will use: volumeMeterSettled() (pure: another repaint would draw the same meter, that is the display has caught up with the input and no peak hold is pending) and VolumeMeterTicker (the shared 16 ms timer: repaints only meters that are visible and not settled, stops when there are none, wake() restarts it, also from another thread). Tests: hidden meters and silent meters stop the timer with no repaints over a few seconds; a wake from another thread restarts it and repaints; a visible meter that still decays keeps it running.
    2. GREEN: the two pieces, and VolumeMeter uses them: it wakes the ticker when a level changes (a silent source sends -inf again, which is not a change) and on showEvent (dock shown, window restored); the timer callback skips meters that are hidden, in a minimized window, or settled.

    Decisions:

    • Settled includes the holds: the peak hold falls back after 20 s and the input peak hold after 1 s, and both are visible changes, so a meter keeps repainting until they have fallen back. After a sound stops, the timer stops about 20 s later, not at once.
    • Minimized: window()->isMinimized() counts as not visible; restoring the window sends a show event, which wakes the ticker.
    • Measurement: before/after on a headless Linux box (Debian 13 LXC, X display without a monitor), with the UI thread's wake-ups and CPU time while all sources are silent.

    First PR today.

  2. added
    claimedAn agent or person has claimed this; check the claim comment before starting
    on Oct 17, 2026
  3. zackees commented on Oct 17, 2026

    @zackees
    MemberAuthor

    Claiming. Plan: stop the shared 16 ms meter timer when no meter is visible (hidden dock, minimized window) and while every meter is idle (level and peak hold unchanged / decayed to the floor), restarting on the next level update or show. Test in the Qt lane: with meters hidden or silent the timer is inactive and no meter repaints happen over a few seconds; with audio it runs at the same rate as today.

  4. github-actions commented on Oct 17, 2026

    @github-actions

    Claim bot: @zackees, this is already claimed by vpacher. Pick something else or offer help here; once the claim goes stale, comment Taking over stale claim from @vpacher.

  5. zackees commented on Oct 17, 2026

    @zackees
    MemberAuthor

    Withdrawing my claim above: @vpacher already has this in PR #1307 (same design: repaint only visible, unsettled meters; the timer stops when none needs it; an audio-thread-safe wake). I missed it when I claimed. Sorry for the noise. I'll review #1307 instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimedAn agent or person has claimed this; check the claim comment before starting

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions