fix flaky test_audio: skip a settle window after signal onset - #1293
Open
1egoman wants to merge 2 commits into
Open
fix flaky test_audio: skip a settle window after signal onset#12931egoman wants to merge 2 commits into
1egoman wants to merge 2 commits into
Conversation
The zero-crossing frequency estimate counted the first 100 frames the subscriber stream delivered, including any silence emitted between subscribing and the arrival of the publisher's first decodable packet. Enough leading silence drags the estimate below the 40Hz floor (observed as 32.5-38.5Hz CI failures in the 24kHz publisher case). Skip frames until one reaches 10% of full scale so the analysis window only covers actual signal. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 29, 2026
1egoman
marked this pull request as draft
July 29, 2026 17:22
This comment was marked as outdated.
This comment was marked as outdated.
The previous onset gate only skipped leading silence; it left the concealment/gaps that a single-PC subscriber receives at stream start (while the bundled SCTP association is set up on the shared transport against a 1.13.3+ server) inside the analysis window, so the flake persisted (1/6 in CI). Detect signal onset, then discard a 500ms settle window before measuring 100 frames of steady-state audio. Keeps the zero-crossing estimate off the noisy startup region. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1egoman
marked this pull request as ready for review
July 29, 2026 18:45
ladvoc
approved these changes
Jul 31, 2026
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.
Problem
test_audiofails intermittently in CI (macOS and Windows) with e.g.:Every occurrence is the
24000Hz,2ch -> 24000Hz,1chcase reading ~32–38Hz for a 60Hz tone. First seen 2026-07-09.Root cause (a real early-audio regression, not just a test artifact)
A CI bisect (6 mac reruns per condition, extracting
test_audio's own verdict) showed:Both conditions are required, so it's an interaction:
pion/webrtcv4.2.15→v4.2.16, whose only media-affecting change isec1dd730"Fix bundle-only data channel startup" — it now runsstartSCTPfor a bundle-only/port-0 datachannel (previously skipped).startSCTPperforms the SCTP association handshake over the shared DTLS transport atsetRemoteDescription, contending with the first audio packets → NetEq emits ~300–400ms of concealment at stream start.Dual-PC is immune (separate subscriber transport); server ≤1.13.2 is immune (never started SCTP for the bundle-only datachannel). The underlying transport contention is a server/pion concern and is being raised separately.
This change (test-side mitigation)
Detect signal onset, then discard a 500ms settle window before measuring 100 frames of steady-state audio. This keeps the estimate off the noisy startup region. (An earlier version of this PR only skipped leading silence, which was insufficient — it left the interleaved startup concealment inside the window and still flaked 1/6.)
🤖 Generated with Claude Code