mirror of
https://github.com/bluenviron/mediamtx
synced 2024-12-12 18:00:12 +00:00
2bd8ac7e19
Co-authored-by: Rafael Scheidt <rafaelscheidt@Rafaels-MacBook-Air.local> Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
34 lines
590 B
Go
34 lines
590 B
Go
package webrtc
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/bluenviron/mediamtx/internal/test"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestPeerConnectionCloseAfterError(t *testing.T) {
|
|
api, err := NewAPI(APIConf{
|
|
LocalRandomUDP: true,
|
|
IPsFromInterfaces: true,
|
|
})
|
|
require.NoError(t, err)
|
|
|
|
pc := &PeerConnection{
|
|
API: api,
|
|
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()
|
|
}
|