Repository navigation
fix(stream): end a stream socket that sends no audio within 15 s - #832
Draft
anneoneone wants to merge 1 commit into
Draft
anneoneone wants to merge 1 commit into
anneoneone wants to merge 1 commit into
Conversation
Port of the backend half of #825 (89f5076) to dev/312-interim. Pings keep the stream socket open without audio. Then the status says "live" and recording, but Icecast plays silence (show 48). If the first audio chunk does not arrive within STREAM_FIRST_AUDIO_TIMEOUT_SECS (default 15), the backend sends an error frame and ends the stream like a dropped connection. A replaced socket leaves the current stream alone; the recording keeps its reconnect grace. The two new tests use interim's connect_producer and a new serve_stream_socket_with helper. Refs: #827
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
6 tasks
This branch was successfully deployed
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.
The backend ends a stream socket whose first audio chunk does not arrive within 15 s, instead of keeping it "on air" with silence. This ports the backend half of #825 (merged to
mainas89f5076, in prod assha-1baf52d) todev/312-interim. The frontend half is a separate PR on the same issue, because a PR has one lane.Issue: #827
Validation:
cargo fmt --check: clean.cargo test --locked --all-targets: 169 unit and 23check-configtests pass, 2 of them new. 2 R2 tests are ignored.cargo clippy --locked --all-targets: exit 0. All warnings are in older code; none is in a changed line.connection_without_audio_is_endedfails on interim's old receive loop: no frame, timeout. This is the same failure as onmain.Implementation and review
Epic: #312
Executor: Claude
Lane: backend
Reviewer: Codex
Leaf IDs: B827.1.1
Claim: #827 (comment). Done by hand at Anton's request. Board Status is not set: the issue is not on board 2, so
set_status.pyrefuses.Cause (show 48, 2026-10-30). The host's Safari 18.3 cannot record WebM. The recorder failed, but the panel kept the stream socket open with pings. The status said "live" and "recording", while Icecast played silence for half an hour. Every session logged
0 chunks / 0 bytes received.Change.
config.rs:stream_first_audio_timeout_secs(envSTREAM_FIRST_AUDIO_TIMEOUT_SECS, serde default 15). Same asmain.stream_ws.rs: whilechunks_received == 0,receiver.next()waits withtimeout_at(first_audio_deadline). On timeout it sendsNO_AUDIO_ERRORand leaves the loop. After the first chunk the loop is unchanged, so later gaps do not trigger it.What differs from #825.
stream_ws.rs: the same hunk. It applies cleanly onto interim's generation logic from fix(stream): keep a replaced producer from stopping its successor #818. The timeout leaves the loop like a dropped connection, so interim'sstop_own_streampath runs unchanged. The stream stops unless another connection replaced it, and the recording gets the 30 s reconnect grace (defer_finalize). A replaced socket that never sent audio also ends after 15 s and leaves the current stream alone.main'sgo_live(state, addr, user, query)isconnect_producerhere, becausebroadcast_tests.rsalready has ago_live.serve_stream_socketgets aserve_stream_socket_with(overrides)variant that adds the overrides on top of the pipe targets.Tests (
backend/src/broadcast_tests.rs, real router and ffmpeg, 1 s limit).connection_without_audio_is_ended: pings only →NO_AUDIO_ERROR, then the stream is not active.first_audio_chunk_lifts_the_no_audio_deadline: one chunk, 1.5 s wait → a pong, no error, the stream stays active.GitNexus.
handle_stream_socketimpact (upstream): LOW, one caller (stream_ws_handler).detect_changesagainstdev/312-interimsays MEDIUM. Its index is from32839db, so line shifts map the hunks onto neighbours (producer_busy,overlay_font_path). It lists only thestream_ws_handlerflows.Not in this PR.
backend/.env.exampledoes not list the new variable (same asmain).complete_multipart_upload: service error.