Skip to content

Hear the station here: stop cutting out behind a proxy or CDN - #36

Merged
epell-development merged 2 commits into
mainfrom
claude/project-thread-hrrk4z
Nov 1, 2026
Merged

epell-development merged 2 commits into
mainfrom
claude/project-thread-hrrk4z

Conversation

@epell-development

Copy link
Copy Markdown
Owner

Requested by epell · project thread

Problem

"Hear the station here" cut in and out every few seconds when the server was reached through its domain (rmstr.listen.dovafm.com), but played fine by IP. A reverse proxy or CDN passes the stream on in bursts. Both ends had very small buffers:

  • the app's jitter buffer started playing after ~0.3 s, and anything past ~1.2 s was dropped when a burst came in;
  • the server skipped audio once ~0.3 s piled up while the connection read slowly.

So every gap between bursts ran the app dry, and each burst then overflowed it.

Changes

  • engine::net_feed_adaptive: the prebuffer doubles each time the sound runs dry after playing, up to a limit, and the channel has room for bursts that size. The Listener starts at ~0.3 s (same as before on a LAN) and can grow to ~6 s. The server's mic keeps its fixed buffer (net_feed).
  • Server /api/v1/listen: lets ~3 s pile up before skipping (LISTEN_BACKLOG), and adds no-transform to Cache-Control.
  • A unit test for the buffer growth.

Checks

cargo fmt, cargo +1.99.0 clippy --all-targets -- -D warnings, cargo test (all pass), tools/smoke_server.sh passed. Not tested against the real domain from here: the cloud sandbox can't reach it.

No CHANGELOG entry yet, because v0.2.10 still has to be tagged. It goes in the next version's section.


Generated by Claude Code

Through a reverse proxy (Cloudflare, nginx, IIS) the server's mix arrives
in bursts. The app's jitter buffer held only ~0.3 s and dropped anything
past ~1.2 s, and the server skipped audio after ~0.3 s of slow reads, so
the sound cut in and out every few seconds while it worked by IP.

- The app's listen buffer starts at ~0.3 s and doubles each time it runs
  dry, up to ~6 s, with room for bursts that size.
- The server lets ~3 s pile up before skipping.
- The listen stream also sends Cache-Control: no-transform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016m2QHXXBfnqtnuqjXmR2zX
@epell-development epell-development self-assigned this Nov 1, 2026

@mergeguards mergeguards Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MergeGuard review
Risk: 🟠 35/100 — moderate
Findings: 🟠 1 medium
Open Files changed for 1 inline review thread on the diff.

💡 Use the Fix All MergeGuard Findings checkbox comment on this PR to apply auto-fixes in batch, or reply @mergeguards fix on any inline finding.


Reviewed by MergeGuard AI

Comment thread src/engine.rs Resolved
@mergeguards

mergeguards Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

MergeGuard agent actions

Fix all findings

All issues (1)
  • medium · src/link.rs:502 — LISTEN_PREBUFFER_MAX (230 blocks ≈ 6s) is hardcoded based on assumptions about proxy burst timing. No validation that grow_to >= prebuffer is enforced at call site, though net_feed_adaptive does en…

Apply auto-fixes for the findings above on this branch:

  • Fix All MergeGuard Findings

Or reply with @mergeguards fix-all on this pull request.

@mergeguards mergeguards Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ MergeGuard — new commits are on this pull request.

Re-scan the latest diff: paste this line by itself (copy/paste is fine) — either on the Conversation tab (Add a comment) or on Files changed as a comment on the diff:

@mergeguard-followup

@mergeguards mergeguards Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MergeGuard review
Risk: 🟠 35/100 — moderate
Findings: 🟠 1 medium
Open Files changed for 1 inline review thread on the diff.

💡 Use the Fix All MergeGuard Findings checkbox comment on this PR to apply auto-fixes in batch, or reply @mergeguards fix on any inline finding.


Reviewed by MergeGuard AI

Comment thread src/link.rs Resolved
@epell-development
epell-development merged commit 8307337 into main Nov 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants