src.nth.io/

summaryrefslogtreecommitdiff
path: root/main/nvs_config.c
diff options
context:
space:
mode:
authorLuke Hoersten <[email protected]>2026-06-20 20:36:54 -0500
committerLuke Hoersten <[email protected]>2026-06-20 20:36:54 -0500
commit5b3b3d3f74fffdcf4023d3f0f3fe9729fadfb8e2 (patch)
tree2c7d72e47cbecfc7ec13987d0822fabc1cca6e59 /main/nvs_config.c
parent3b0ab735d8764e536bf085ec07a95e427d60a6c1 (diff)
firmware: keep TCP recv window at IDF defaults (5760) — bigger window regressed g2g
Step-2 experiment from the iterative tuning plan: bumped CONFIG_LWIP_TCP_WND_DEFAULT 5760 → 65535 (and matching SND_BUF + RECVMBOX 6 → 16) under the hypothesis that the 4×MSS window throttled receive throughput. Instrumentation showed the window WAS the per-call throttle (recv_chunk_max was exactly 5760 before, grew to 33-60KB after). But end-to-end got dramatically worse: - g2g exploded from ~100ms steady to 17 SECONDS growing unbounded (1964 → 6010 → 10632 → 14725 → 17889ms over consecutive windows). - painted dropped from ~24fps to 15-20fps. - recv_avg rose from 32ms steady to 50-90ms with frequent 230-500ms outliers (the retransmit / RTO signature). - chunk_min fell to 61 bytes, chunk_avg dropped from 3415 to ~2200 — fragmentation as lwIP RX struggled with the bigger bursts. Root cause: the single recv→decode→paint task serializes; the kernel buffer fills against ANY window during the ~6ms decode+paint, but with 65535 bytes available the sender pumps ~45 segments before stopping vs ~4 before. That overruns the lwIP RX path (RECVMBOX=16 mailboxes, default pbuf pool) → drops → retransmits → multi-frame stalls. And Scrypted has no way to skip-oldest on the kernel queue, so frames just pile up on the wire / in the ESP32 kernel buffer → g2g grows linearly with time. Lesson: window size isn't the right knob until the receiver can drain at line rate independent of decode+paint. Next iteration: split recv into its own FreeRTOS task with a 1-deep latest-frame slot to the decode/paint task — only then revisit window.
Diffstat (limited to 'main/nvs_config.c')
0 files changed, 0 insertions, 0 deletions