Tiered (segmented) waterfall
The server now streams only the spectrum tiles a client's viewport overlaps,
folded to roughly one bin per CSS pixel, instead of every client receiving the
full FFT resolution.
- Per-dongle octave fold ladder (1..=8 tiers).
waterfallTierCount: 0(the
default) picks the largest useful ladder from the FFT and tile geometry: 4
tiers at 8192 bins, 5 at 16384, 7 at 65536 with 1024-bin tiles. - Tiles are lazy: encoders and history rings are allocated when a client
first views a tile and freed when the last one leaves. - V1 tiled framing on the existing messages (
0x01/0x04/0x08/0x0B/0x0D): a
verFlagsbyte (0x11) plus a 6-bytetier/tileIndex/tileCountblock, then
the unchanged codec body. Legacy frames are untouched and still decode. - Clients request a viewport with
{"cmd":"waterfall_view", …}and get a
screen-sized strip from the first frame, including the full span; the view
is re-requested on resize and on a newwaterfall_refreshevent. waterfall_refreshis sent when the admin changes the waterfall config, a
dongle restarts, or an operator presses Send Refresh in the admin page.
Configuration (admin-editable)
| Key | Default | Meaning |
|---|---|---|
waterfallTileBins
| 1024 | bins per tile (power of two, clamped to fftSize/8)
|
waterfallTileHistoryFrames
| 256 | prefill history per active tile |
waterfallTierCount
| 0 (auto) | fold tiers; auto stops when the coarsest tier is one whole tile |
Results
Measured on a real RTL-SDR over rtl_tcp, 16384 bins, 8 fps, one client:
| FFT wire | |
|---|---|
| legacy, any zoom | 55.9 KB/s |
| tiled, full span (tier 3, 2048 bins) | 6.7 KB/s |
| tiled, narrow viewport (tier 4, 1024 bins) | 3–4 KB/s |
At 8192 bins a first connect drops from 36.9 KB/s to 9.0 KB/s, and zoomed views
get both less traffic and more real resolution than a cropped full-frame.
Fixes
- Whole-server deadlock in
handle_waterfall_view: theclient_pipelines
map lock was held acrosscreate_client_pipeline, which re-locks it. Any
client that sent awaterfall_viewbefore its pipeline existed hung FFT
broadcast, subscribe, disconnect and every other client. - Tiered history memory reduced ~4x by default (configurable per tile).
- Each tier is folded once per frame instead of twice.
- Tile refcounts are released on profile switches and when the ladder is rebuilt.
- The Signal Analysis pane no longer leaves the waterfall zoom hijacked after it
closes.
Full Changelog: v2.20.0...v2.21.0