make the outgoing packet interval configurable

Add -audio-interval to choose a 10, 20, 40, or 60 ms packet duration.
Longer packets cut per-packet overhead on slow or lossy links at the
cost of latency. Anything else is rejected at startup rather than
silently truncated to 10 ms frames.

Step the audio sequence by the frame duration.
Sequence numbers are Mumble timestamps in 10 ms units, so a 60 ms
packet advances the counter by six. Incrementing by one made the
receiver see every packet as arriving far too early.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Brandon McGinty
2026-08-20 14:42:52 -04:00
co-authored by Claude Opus 5
parent 6dcaa7f7a6
commit 7e1faba06b
2 changed files with 23 additions and 1 deletions
+5 -1
View File
@@ -263,11 +263,15 @@ func (c *Client) AudioOutgoing() chan<- AudioBuffer {
ch := make(chan AudioBuffer)
go func() {
var seq int64
frameStep := int64(c.Config.AudioFrameSize() / AudioDefaultFrameSize)
if frameStep < 1 {
frameStep = 1
}
previous := <-ch
for p := range ch {
previous.writeAudio(c, seq, false)
previous = p
seq = (seq + 1) % math.MaxInt32
seq = (seq + frameStep) % math.MaxInt32
}
if previous != nil {
previous.writeAudio(c, seq, true)