Documentation
¶
Overview ¶
Package peer wraps Pion's RTCPeerConnection with the few extras goloom requires: ICE candidate buffering until remote description is set, and a uniform logging prefix so PUB and SUB events are easy to tell apart.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildAPI ¶
BuildAPI constructs a Pion webrtc.API with a minimal MediaEngine matching the codecs Telemost's web client offers in its publisher SDP:
- audio/opus PT=111 with minptime=10;useinbandfec=1, transport-cc + nack
- video/VP8 PT=96 with goog-remb, transport-cc, ccm fir, nack, nack pli
VP9 / H264 / AV1 / RED are intentionally not registered for PoC #1 — one codec per kind keeps SDP and renegotiation simple. The SFU has VP8 in its subscriber answer offerings, so this is enough to receive too.
func ToConfig ¶
func ToConfig(servers []goloom.ServerICEEntry) webrtc.Configuration
ToConfig converts the goloom-supplied ice_servers list into a Pion webrtc.Configuration with BUNDLE max-bundle (Telemost requires it — its publisher offer always uses a=group:BUNDLE 0 1).
Types ¶
type Wrapper ¶
type Wrapper struct {
Name string // "PUB" or "SUB"
PC *webrtc.PeerConnection
Log *log.Logger
// contains filtered or unexported fields
}
Wrapper owns one Pion PeerConnection plus the bits we need around it.
func New ¶
New builds a PeerConnection from the supplied API + Configuration. The caller wires OnICECandidate / OnTrack / OnDataChannel / OnConnectionStateChange before adding tracks or applying SDP.
func (*Wrapper) AddICECandidate ¶
func (w *Wrapper) AddICECandidate(c webrtc.ICECandidateInit) error
AddICECandidate buffers if remote description not yet applied, applies directly otherwise. The double-check pattern avoids losing candidates that arrive concurrently with SetRemoteDescriptionAndFlush.
func (*Wrapper) SetRemoteDescriptionAndFlush ¶
func (w *Wrapper) SetRemoteDescriptionAndFlush(d webrtc.SessionDescription) error
SetRemoteDescriptionAndFlush applies the SDP, marks the remote-set flag, and drains any ICE candidates that arrived before it.