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:
co-authored by
Claude Opus 5
parent
6dcaa7f7a6
commit
7e1faba06b
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user