Documentation
¶
Overview ¶
Package vnettest sets up real pion peer connections on an in-memory virtual network, for integration tests that exercise media paths without a server.
It depends only on pion, so it can be imported both by tests inside pkg/... and by the top level test package.
Index ¶
- Constants
- func GatheredOffer(t *testing.T, pc *webrtc.PeerConnection) webrtc.SessionDescription
- func NewMediaEngine(t *testing.T, cfg MediaEngineConfig) *webrtc.MediaEngine
- func NewPeerConnection(t *testing.T, cfg PCConfig) *webrtc.PeerConnection
- func NewSettingEngine(net *vnet.Net) webrtc.SettingEngine
- func SignalPair(t *testing.T, offerer, answerer *webrtc.PeerConnection)
- func UntilConnected(pcs ...*webrtc.PeerConnection) <-chan struct{}
- func VideoRTCPFeedback() []webrtc.RTCPFeedback
- type Hosts
- type MediaEngineConfig
- type PCConfig
Constants ¶
const ( VP8PayloadType = 96 RTXPayloadType = VP8PayloadType + 1 OpusPayloadType = 111 )
Variables ¶
This section is empty.
Functions ¶
func GatheredOffer ¶
func GatheredOffer(t *testing.T, pc *webrtc.PeerConnection) webrtc.SessionDescription
GatheredOffer creates an offer and waits for gathering, so the SDP carries every candidate and the caller needs no trickle.
func NewMediaEngine ¶
func NewMediaEngine(t *testing.T, cfg MediaEngineConfig) *webrtc.MediaEngine
func NewPeerConnection ¶
func NewPeerConnection(t *testing.T, cfg PCConfig) *webrtc.PeerConnection
NewPeerConnection builds a peer connection on the virtual network with no interceptors, so nothing rewrites what a test puts on the wire.
func NewSettingEngine ¶
func NewSettingEngine(net *vnet.Net) webrtc.SettingEngine
NewSettingEngine returns a setting engine bound to net, with ICE timeouts short enough to keep tests quick.
func SignalPair ¶
func SignalPair(t *testing.T, offerer, answerer *webrtc.PeerConnection)
SignalPair performs a full offer/answer exchange between two peer connections and waits for both to connect.
func UntilConnected ¶
func UntilConnected(pcs ...*webrtc.PeerConnection) <-chan struct{}
UntilConnected closes the returned channel once every peer connection is connected.
func VideoRTCPFeedback ¶
func VideoRTCPFeedback() []webrtc.RTCPFeedback
Types ¶
type MediaEngineConfig ¶
type MediaEngineConfig struct {
Video bool // VP8 and its RTX codec; otherwise opus
HeaderExtensions bool // abs-send-time + transport-cc
SimulcastExtensions bool // mid + rid + rsid
}
MediaEngineConfig describes what to register on a media engine.
type PCConfig ¶
type PCConfig struct {
Net *vnet.Net
MediaEngine MediaEngineConfig
// BufferFactory is SettingEngine.BufferFactory, e. g. buffer.Factory.GetOrNew.
// Optional.
BufferFactory func(packetType packetio.BufferPacketType, ssrc uint32) io.ReadWriteCloser
}
PCConfig describes a peer connection on the virtual network.