Skip to content

fix: reject custom audio that WebRTC cannot send - #540

Merged
devopvoid merged 1 commit into
mainfrom
fix/custom-audio-validation
Nov 5, 2026
Merged

devopvoid merged 1 commit into
mainfrom
fix/custom-audio-validation

Conversation

@devopvoid

Copy link
Copy Markdown
Owner

CustomAudioSource.pushAudio() accepted chunks the encoder drops without a trace, so the call succeeded while no packet was sent. Some formats went further and aborted the process: 17 to 24 channels, since MAX_CHANNELS was out of date, and very low sample rates.

  • pushAudio() now requires exactly 10 ms per chunk, 1, 2, 4, 6 or 8 channels and 8 to 192 kHz
  • PcmFormat.of() rejects the same channel counts and rates, so a client API track fails at creation rather than on every tick
  • MAX_CHANNELS drops from 24 to 8, MIN_SAMPLE_RATE and MAX_SAMPLE_RATE are new

This also rejects other chunk sizes on a source that only feeds local sinks, which used to work. Audio of other lengths has to be split into 10 ms chunks first, which CustomAudio.push() already does.

pushAudio accepted chunks the encoder drops silently and formats that abort the process. It now requires exactly 10 ms, 1, 2, 4, 6 or 8 channels and 8 to 192 kHz; PcmFormat follows.
@devopvoid
devopvoid merged commit a9b41ca into main Nov 5, 2026
26 checks passed
@devopvoid
devopvoid deleted the fix/custom-audio-validation branch November 5, 2026 12:29
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.

1 participant