Test local Mumble TCP audio fallback
This commit is contained in:
committed by
Brandon McGinty
parent
c9c6d6bab1
commit
5cd23f5df8
@@ -27,7 +27,13 @@ func (l *integrationAudioListener) OnAudioStream(e *gumble.AudioStreamEvent) {
|
|||||||
|
|
||||||
// TestLocalMumbleAudioRoundTrip sends generated 440 Hz audio through a real
|
// TestLocalMumbleAudioRoundTrip sends generated 440 Hz audio through a real
|
||||||
// local Mumble server and requires the other client to decode non-silent PCM.
|
// local Mumble server and requires the other client to decode non-silent PCM.
|
||||||
func TestLocalMumbleAudioRoundTrip(t *testing.T) {
|
func TestLocalMumbleAudioRoundTrip(t *testing.T) { testLocalMumbleAudioRoundTrip(t, false) }
|
||||||
|
|
||||||
|
// Regression: TCP tunnel fallback must remain usable when UDP is deliberately
|
||||||
|
// disabled or blocked, rather than silently dropping valid audio.
|
||||||
|
func TestLocalMumbleTCPAudioFallback(t *testing.T) { testLocalMumbleAudioRoundTrip(t, true) }
|
||||||
|
|
||||||
|
func testLocalMumbleAudioRoundTrip(t *testing.T, disableUDP bool) {
|
||||||
if os.Getenv("BARNARD_MUMBLE_INTEGRATION") != "1" {
|
if os.Getenv("BARNARD_MUMBLE_INTEGRATION") != "1" {
|
||||||
t.Skip("set BARNARD_MUMBLE_INTEGRATION=1")
|
t.Skip("set BARNARD_MUMBLE_INTEGRATION=1")
|
||||||
}
|
}
|
||||||
@@ -35,7 +41,7 @@ func TestLocalMumbleAudioRoundTrip(t *testing.T) {
|
|||||||
c := gumble.NewConfig()
|
c := gumble.NewConfig()
|
||||||
c.Address = "localhost:64738"
|
c.Address = "localhost:64738"
|
||||||
c.Username = name
|
c.Username = name
|
||||||
c.DisableUDP = false
|
c.DisableUDP = disableUDP
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
tlsConfig := &tls.Config{InsecureSkipVerify: true}
|
tlsConfig := &tls.Config{InsecureSkipVerify: true}
|
||||||
@@ -57,7 +63,11 @@ func TestLocalMumbleAudioRoundTrip(t *testing.T) {
|
|||||||
t.Fatal("no negotiated audio encoder")
|
t.Fatal("no negotiated audio encoder")
|
||||||
}
|
}
|
||||||
time.Sleep(1500 * time.Millisecond)
|
time.Sleep(1500 * time.Millisecond)
|
||||||
if !sender.UDPActive() || !receiver.UDPActive() {
|
if disableUDP {
|
||||||
|
if sender.UDPActive() || receiver.UDPActive() {
|
||||||
|
t.Fatal("UDP activated despite TCP-only configuration")
|
||||||
|
}
|
||||||
|
} else if !sender.UDPActive() || !receiver.UDPActive() {
|
||||||
t.Fatalf("native UDP did not become active: sender=%v receiver=%v", 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())
|
frame := make([]int16, sendConfig.AudioFrameSize())
|
||||||
|
|||||||
Reference in New Issue
Block a user