bound the configured audio buffer count

Buffers had a lower bound but no upper one, and it is allocated per speaking
user twice over: as a queue of decoded frames and as OpenAL playback
buffers. Each buffer holds up to one maximum sized frame, so a large value
multiplied by a populated channel is a substantial amount of memory.

Cap it, and reject the flag up front so the failure names the flag rather
than surfacing later as a dial error.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Brandon McGinty
2026-08-24 12:32:44 -04:00
co-authored by Claude Opus 5
parent 0d62f745ca
commit ef9bd19fc9
3 changed files with 33 additions and 0 deletions
+4
View File
@@ -105,6 +105,10 @@ func main() {
if err != nil {
handle_raw_error(err)
}
if *buffers <= 0 || *buffers > gumble.MaximumBuffers {
handle_raw_error(fmt.Errorf("buffers must be between 1 and %d, got %d",
gumble.MaximumBuffers, *buffers))
}
// Set up logging
var level barnlog.Level