2024-03-06 21:38:36 +00:00
|
|
|
package webrtc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/bluenviron/mediamtx/internal/test"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestPeerConnectionCloseAfterError(t *testing.T) {
|
2024-05-19 17:41:42 +00:00
|
|
|
pc := &PeerConnection{
|
2024-03-06 21:38:36 +00:00
|
|
|
LocalRandomUDP: true,
|
|
|
|
IPsFromInterfaces: true,
|
2024-05-19 17:41:42 +00:00
|
|
|
Publish: false,
|
|
|
|
Log: test.NilLogger,
|
2024-03-06 21:38:36 +00:00
|
|
|
}
|
2024-05-19 17:41:42 +00:00
|
|
|
err := pc.Start()
|
2024-03-06 21:38:36 +00:00
|
|
|
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()
|
|
|
|
}
|