Documentation ¶
Index ¶
- type Buffer
- func (b *Buffer) GetLostRateBandwidth(cycle uint64) (float64, uint64)
- func (b *Buffer) GetNackPair(buffer [65536]*rtp.Packet, begin, end uint16) (rtcp.NackPair, int)
- func (b *Buffer) GetPacket(sn uint16) *rtp.Packet
- func (b *Buffer) GetPayloadType() uint8
- func (b *Buffer) GetRTCPChan() chan rtcp.Packet
- func (b *Buffer) GetSSRC() uint32
- func (b *Buffer) Push(p *rtp.Packet)
- func (b *Buffer) Stop()
- type BufferOptions
- type Config
- type ICEServerConfig
- type MediaEngine
- type Receiver
- type ReceiverConfig
- type Router
- type SFU
- type Sender
- type Session
- type Transport
- type WebRTCAudioReceiver
- func (a *WebRTCAudioReceiver) Close()
- func (a *WebRTCAudioReceiver) GetPacket(sn uint16) *rtp.Packet
- func (a *WebRTCAudioReceiver) ReadRTCP() (rtcp.Packet, error)
- func (a *WebRTCAudioReceiver) ReadRTP() (*rtp.Packet, error)
- func (a *WebRTCAudioReceiver) Track() *webrtc.Track
- func (a *WebRTCAudioReceiver) WriteRTCP(pkt rtcp.Packet) error
- type WebRTCConfig
- type WebRTCSender
- type WebRTCTransport
- func (p *WebRTCTransport) AddICECandidate(candidate webrtc.ICECandidateInit) error
- func (p *WebRTCTransport) Close() error
- func (p *WebRTCTransport) CreateAnswer() (webrtc.SessionDescription, error)
- func (p *WebRTCTransport) CreateOffer() (webrtc.SessionDescription, error)
- func (p *WebRTCTransport) GetRouter(ssrc uint32) *Router
- func (p *WebRTCTransport) ID() string
- func (p *WebRTCTransport) NewSender(intrack *webrtc.Track) (Sender, error)
- func (p *WebRTCTransport) OnConnectionStateChange(f func(webrtc.PeerConnectionState))
- func (p *WebRTCTransport) OnICECandidate(f func(c *webrtc.ICECandidate))
- func (p *WebRTCTransport) OnNegotiationNeeded(f func())
- func (p *WebRTCTransport) OnTrack(f func(*webrtc.Track, *webrtc.RTPReceiver))
- func (p *WebRTCTransport) Routers() map[uint32]*Router
- func (p *WebRTCTransport) SetLocalDescription(desc webrtc.SessionDescription) error
- func (p *WebRTCTransport) SetRemoteDescription(desc webrtc.SessionDescription) error
- type WebRTCTransportConfig
- type WebRTCVideoReceiver
- func (v *WebRTCVideoReceiver) Close()
- func (v *WebRTCVideoReceiver) GetPacket(sn uint16) *rtp.Packet
- func (v *WebRTCVideoReceiver) ReadRTCP() (rtcp.Packet, error)
- func (v *WebRTCVideoReceiver) ReadRTP() (*rtp.Packet, error)
- func (v *WebRTCVideoReceiver) Track() *webrtc.Track
- func (v *WebRTCVideoReceiver) WriteRTCP(pkt rtcp.Packet) error
- type WebRTCVideoReceiverConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer contains all packets
func NewBuffer ¶
func NewBuffer(ssrc uint32, pt uint8, o BufferOptions) *Buffer
NewBuffer constructs a new Buffer
func (*Buffer) GetLostRateBandwidth ¶
GetLostRateBandwidth calc lostRate and bandwidth by cycle
func (*Buffer) GetNackPair ¶
GetNackPair calc nackpair
func (*Buffer) GetPayloadType ¶
GetPayloadType get payloadtype
func (*Buffer) GetRTCPChan ¶
GetRTCPChan return rtcp channel
type BufferOptions ¶
type BufferOptions struct {
BufferTime int
}
type Config ¶
type Config struct { WebRTC WebRTCConfig `mapstructure:"webrtc"` Log log.Config `mapstructure:"log"` Receiver ReceiverConfig `mapstructure:"receiver"` }
Config for base SFU
type ICEServerConfig ¶
type ICEServerConfig struct { URLs []string `mapstructure:"urls"` Username string `mapstructure:"username"` Credential string `mapstructure:"credential"` }
ICEServerConfig defines parameters for ice servers
type MediaEngine ¶
type MediaEngine struct {
webrtc.MediaEngine
}
MediaEngine handles stream codecs
func (*MediaEngine) PopulateFromSDP ¶
func (e *MediaEngine) PopulateFromSDP(sd webrtc.SessionDescription) error
PopulateFromSDP finds all codecs in sd and adds them to m, using the dynamic payload types and parameters from sd. PopulateFromSDP is intended for use when answering a request. The offerer sets the PayloadTypes for the connection. PopulateFromSDP allows an answerer to properly match the PayloadTypes from the offerer. A MediaEngine populated by PopulateFromSDP should be used only for a single session.
type Receiver ¶
type Receiver interface { Track() *webrtc.Track GetPacket(sn uint16) *rtp.Packet ReadRTP() (*rtp.Packet, error) ReadRTCP() (rtcp.Packet, error) WriteRTCP(rtcp.Packet) error Close() // contains filtered or unexported methods }
Receiver defines a interface for a track receiver
type ReceiverConfig ¶
type ReceiverConfig struct {
Video WebRTCVideoReceiverConfig `mapstructure:"video"`
}
ReceiverConfig defines receiver configurations
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router defines a track rtp/rtcp router
type SFU ¶
type SFU struct {
// contains filtered or unexported fields
}
SFU represents an sfu instance
func (*SFU) NewWebRTCTransport ¶
func (s *SFU) NewWebRTCTransport(sid string, offer webrtc.SessionDescription) (*WebRTCTransport, error)
NewWebRTCTransport creates a new WebRTCTransport that is a member of a session
type Sender ¶
type Sender interface { ReadRTCP() (rtcp.Packet, error) WriteRTP(*rtp.Packet) Close() // contains filtered or unexported methods }
Sender defines a interface for a track receiver
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session represents a set of transports. Transports inside a session are automatically subscribed to each other.
func (*Session) AddTransport ¶
AddTransport adds a transport to the session
func (*Session) RemoveTransport ¶
RemoveTransport removes a transport for the session
func (*Session) Transports ¶
Transports returns transports in this session
type Transport ¶
type Transport interface { ID() string GetRouter(uint32) *Router Routers() map[uint32]*Router NewSender(*webrtc.Track) (Sender, error) // contains filtered or unexported methods }
Transport represents a transport that media can be sent over
type WebRTCAudioReceiver ¶
type WebRTCAudioReceiver struct {
// contains filtered or unexported fields
}
WebRTCAudioReceiver receives a audio track
func NewWebRTCAudioReceiver ¶
func NewWebRTCAudioReceiver(track *webrtc.Track) *WebRTCAudioReceiver
NewWebRTCAudioReceiver creates a new audio track receiver
func (*WebRTCAudioReceiver) GetPacket ¶
func (a *WebRTCAudioReceiver) GetPacket(sn uint16) *rtp.Packet
GetPacket returns nil since audio isn't buffered (uses fec)
func (*WebRTCAudioReceiver) ReadRTCP ¶
func (a *WebRTCAudioReceiver) ReadRTCP() (rtcp.Packet, error)
ReadRTCP read rtcp packet
func (*WebRTCAudioReceiver) ReadRTP ¶
func (a *WebRTCAudioReceiver) ReadRTP() (*rtp.Packet, error)
ReadRTP read rtp packet
func (*WebRTCAudioReceiver) Track ¶
func (a *WebRTCAudioReceiver) Track() *webrtc.Track
Track returns receiver track
type WebRTCConfig ¶
type WebRTCConfig struct { ICEPortRange []uint16 `mapstructure:"portrange"` ICEServers []ICEServerConfig `mapstructure:"iceserver"` }
WebRTCConfig defines parameters for ice
type WebRTCSender ¶
type WebRTCSender struct {
// contains filtered or unexported fields
}
WebRTCSender represents a Sender which writes RTP to a webrtc track
func NewWebRTCSender ¶
func NewWebRTCSender(track *webrtc.Track, sender *webrtc.RTPSender) *WebRTCSender
NewWebRTCSender creates a new track sender instance
func (*WebRTCSender) ReadRTCP ¶
func (s *WebRTCSender) ReadRTCP() (rtcp.Packet, error)
ReadRTCP read rtp packet
func (*WebRTCSender) WriteRTP ¶
func (s *WebRTCSender) WriteRTP(pkt *rtp.Packet)
WriteRTP to the track
type WebRTCTransport ¶
type WebRTCTransport struct {
// contains filtered or unexported fields
}
WebRTCTransport represents a sfu peer connection
func NewWebRTCTransport ¶
func NewWebRTCTransport(session *Session, offer webrtc.SessionDescription, cfg WebRTCTransportConfig) (*WebRTCTransport, error)
NewWebRTCTransport creates a new WebRTCTransport
func (*WebRTCTransport) AddICECandidate ¶
func (p *WebRTCTransport) AddICECandidate(candidate webrtc.ICECandidateInit) error
AddICECandidate to peer connection
func (*WebRTCTransport) CreateAnswer ¶
func (p *WebRTCTransport) CreateAnswer() (webrtc.SessionDescription, error)
CreateAnswer generates the localDescription
func (*WebRTCTransport) CreateOffer ¶
func (p *WebRTCTransport) CreateOffer() (webrtc.SessionDescription, error)
CreateOffer generates the localDescription
func (*WebRTCTransport) GetRouter ¶
func (p *WebRTCTransport) GetRouter(ssrc uint32) *Router
GetRouter returns router with ssrc
func (*WebRTCTransport) NewSender ¶
func (p *WebRTCTransport) NewSender(intrack *webrtc.Track) (Sender, error)
NewSender for peer
func (*WebRTCTransport) OnConnectionStateChange ¶
func (p *WebRTCTransport) OnConnectionStateChange(f func(webrtc.PeerConnectionState))
OnConnectionStateChange handler
func (*WebRTCTransport) OnICECandidate ¶
func (p *WebRTCTransport) OnICECandidate(f func(c *webrtc.ICECandidate))
OnICECandidate handler
func (*WebRTCTransport) OnNegotiationNeeded ¶
func (p *WebRTCTransport) OnNegotiationNeeded(f func())
OnNegotiationNeeded handler
func (*WebRTCTransport) OnTrack ¶
func (p *WebRTCTransport) OnTrack(f func(*webrtc.Track, *webrtc.RTPReceiver))
OnTrack handler
func (*WebRTCTransport) Routers ¶
func (p *WebRTCTransport) Routers() map[uint32]*Router
Routers returns routers for this peer
func (*WebRTCTransport) SetLocalDescription ¶
func (p *WebRTCTransport) SetLocalDescription(desc webrtc.SessionDescription) error
SetLocalDescription sets the SessionDescription of the remote peer
func (*WebRTCTransport) SetRemoteDescription ¶
func (p *WebRTCTransport) SetRemoteDescription(desc webrtc.SessionDescription) error
SetRemoteDescription sets the SessionDescription of the remote peer
type WebRTCTransportConfig ¶ added in v1.0.3
type WebRTCTransportConfig struct {
// contains filtered or unexported fields
}
WebRTCTransportConfig represents configuration options
type WebRTCVideoReceiver ¶
type WebRTCVideoReceiver struct {
// contains filtered or unexported fields
}
WebRTCVideoReceiver receives a video track
func NewWebRTCVideoReceiver ¶
func NewWebRTCVideoReceiver(config WebRTCVideoReceiverConfig, track *webrtc.Track) *WebRTCVideoReceiver
NewWebRTCVideoReceiver creates a new video track receiver
func (*WebRTCVideoReceiver) GetPacket ¶
func (v *WebRTCVideoReceiver) GetPacket(sn uint16) *rtp.Packet
GetPacket get a buffered packet if we have one
func (*WebRTCVideoReceiver) ReadRTCP ¶
func (v *WebRTCVideoReceiver) ReadRTCP() (rtcp.Packet, error)
ReadRTCP read rtcp packets
func (*WebRTCVideoReceiver) ReadRTP ¶
func (v *WebRTCVideoReceiver) ReadRTP() (*rtp.Packet, error)
ReadRTP read rtp packets
func (*WebRTCVideoReceiver) Track ¶
func (v *WebRTCVideoReceiver) Track() *webrtc.Track
Track returns receiver track
type WebRTCVideoReceiverConfig ¶
type WebRTCVideoReceiverConfig struct { REMBCycle int `mapstructure:"rembcycle"` PLICycle int `mapstructure:"plicycle"` TCCCycle int `mapstructure:"tcccycle"` MaxBandwidth int `mapstructure:"maxbandwidth"` MaxBufferTime int `mapstructure:"maxbuffertime"` }
WebRTCVideoReceiverConfig .