Verify native UDP audio against local Mumble

This commit is contained in:
Brandon McGinty (chatgpt)
2026-08-09 20:35:18 -04:00
committed by Brandon McGinty
parent b324106d3a
commit c9c6d6bab1
2 changed files with 13 additions and 2 deletions
+8
View File
@@ -387,6 +387,14 @@ func (c *Client) WriteAudio(format, target byte, sequence int64, final bool, dat
return c.Conn.WriteAudio(format, target, sequence, final, data, X, Y, Z)
}
// UDPActive reports whether an authenticated UDP packet has confirmed the
// return path and outgoing audio may use native UDP.
func (c *Client) UDPActive() bool {
c.udpMu.RLock()
defer c.udpMu.RUnlock()
return c.udpActive
}
// DisableStereoEncoder switches back to mono encoding for voice and
// resets the stereo encoder so stale state does not bleed into the
// next file playback.
+5 -2
View File
@@ -35,7 +35,7 @@ func TestLocalMumbleAudioRoundTrip(t *testing.T) {
c := gumble.NewConfig()
c.Address = "localhost:64738"
c.Username = name
c.DisableUDP = true
c.DisableUDP = false
return c
}
tlsConfig := &tls.Config{InsecureSkipVerify: true}
@@ -56,7 +56,10 @@ func TestLocalMumbleAudioRoundTrip(t *testing.T) {
if sender.AudioEncoder == nil {
t.Fatal("no negotiated audio encoder")
}
time.Sleep(500 * time.Millisecond)
time.Sleep(1500 * time.Millisecond)
if !sender.UDPActive() || !receiver.UDPActive() {
t.Fatalf("native UDP did not become active: sender=%v receiver=%v", sender.UDPActive(), receiver.UDPActive())
}
frame := make([]int16, sendConfig.AudioFrameSize())
for i := 0; i < 8; i++ {
for sample := range frame {