Files
rtsp-simple-server/internal/protocols/webrtc/peer_connection_test.go
Jason Walton 1c2f95f609 webrtc: allow configuring timeouts (#3404) (#3406)
* webrtc: allow configuring timeouts (#3404)

* fix from code inspect
2024-05-30 13:36:58 +02:00

32 lines
709 B
Go

package webrtc
import (
"testing"
"time"
"github.com/bluenviron/mediamtx/internal/conf"
"github.com/bluenviron/mediamtx/internal/test"
"github.com/stretchr/testify/require"
)
func TestPeerConnectionCloseAfterError(t *testing.T) {
pc := &PeerConnection{
HandshakeTimeout: conf.StringDuration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second),
LocalRandomUDP: true,
IPsFromInterfaces: true,
Publish: false,
Log: test.NilLogger,
}
err := pc.Start()
require.NoError(t, err)
_, err = pc.CreatePartialOffer()
require.NoError(t, err)
// wait for ICE candidates to be generated
time.Sleep(500 * time.Millisecond)
pc.Close()
}