Verify native UDP audio against local Mumble
This commit is contained in:
committed by
Brandon McGinty
parent
b324106d3a
commit
c9c6d6bab1
@@ -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.
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user