Commit Graph
8 Commits
Author SHA1 Message Date
Brandon McGinty (chatgpt) aa38c99aab Scale Opus bitrate to audio frame duration 2026-08-09 14:36:00 -04:00
Brandon McGinty (deepseek) cd968d7530 fix: fix double channel-counting in Opus decoder buffer allocation
AudioMaximumFrameSize (5760) already accounts for stereo by including
the AudioChannels factor. The Decode method was multiplying by
AudioChannels again, allocating 11520 int16s per decode call instead
of the needed 5760. This wasted ~21KB per audio packet (2MB/s at
100 pps). Use frameSize directly and derive total sample count from
the decoder's configured channel count.
2026-08-08 19:38:39 -04:00
Brandon McGinty (deepseek) 181b325c2d fix: add minimum Opus bitrate floor in encoder
Add a defensive floor of 8000 bps in the Encode method, preventing the
encoder from being configured with an invalidly low bitrate even if
AudioDataBytes is somehow set to a very small value.
2026-08-08 19:18:35 -04:00
Brandon McGinty (deepseek) 5c1cd69d65 fix: configure Opus encoder bitrate from available bandwidth
Replace SetBitrateToMax() with dynamic bitrate configuration based on
the per-frame byte budget (AudioDataBytes). Previously, the encoder
always targeted maximum bitrate (~510 kbps) and relied on output
truncation when frames exceeded the available bandwidth. This could
produce truncated/invalid Opus frames when the server's max bandwidth
is lower than the encoder's target.

The bitrate is now recalculated on every Encode() call as:
  maxDataBytes * 8 * 100 (bits per second for 10ms frames)

This ensures the encoder produces frames that fit within the byte
budget without truncation.
2026-08-08 19:17:31 -04:00
Storm Dragon 81a928e122 Update stale Go dependencies 2026-05-14 12:21:15 -04:00
Storm Dragon fae372bb78 Added /file and /stop commands. 2025-11-30 20:31:06 -05:00
Storm Dragon 2e337db3c5 Updated everything for dependencies. All sub packages are now part of the project. This was a massive update, hopefully won't have to be reverted. 2025-01-16 17:03:01 -05:00
Storm Dragon 3f0246a4f8 Initial commit, lots of cleanup and stuff to do, it may not work. 2025-01-15 23:43:44 -05:00