Documentation ¶
Index ¶
- Constants
- Variables
- func Init(elems map[string]ElementFun)
- type Builder
- type Config
- type Element
- type ElementFun
- type PendingProcess
- type Publisher
- func (p *Publisher) AddICECandidate(candidate webrtc.ICECandidateInit) error
- func (p *Publisher) Close() error
- func (p *Publisher) CreateOffer() (webrtc.SessionDescription, error)
- func (p *Publisher) OnICECandidate(f func(c *webrtc.ICECandidate))
- func (p *Publisher) SetRemoteDescription(desc webrtc.SessionDescription) error
- type Registry
- type SFUFeedback
- type Sample
- type Samplebuilderconf
- type Subscriber
- func (s *Subscriber) AddICECandidate(candidate webrtc.ICECandidateInit) error
- func (s *Subscriber) Answer(offer webrtc.SessionDescription) (webrtc.SessionDescription, error)
- func (s *Subscriber) Close() error
- func (s *Subscriber) OnICECandidate(f func(c *webrtc.ICECandidate))
- func (s *Subscriber) OnTrack(f func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver))
- type WebRTCTransport
- func (t *WebRTCTransport) AddICECandidate(candidate webrtc.ICECandidateInit, target int) error
- func (t *WebRTCTransport) Answer(offer webrtc.SessionDescription) (webrtc.SessionDescription, error)
- func (t *WebRTCTransport) Close() error
- func (t *WebRTCTransport) CreateOffer() (webrtc.SessionDescription, error)
- func (t *WebRTCTransport) OnClose(f func())
- func (t *WebRTCTransport) OnICECandidate(f func(c *webrtc.ICECandidate, target int))
- func (t *WebRTCTransport) Process(pid, tid, eid string, config []byte) error
- func (t *WebRTCTransport) SetRemoteDescription(desc webrtc.SessionDescription) error
- type WebRTCTransportConfig
Constants ¶
const ( MimeTypeH264 = "video/h264" MimeTypeOpus = "audio/opus" MimeTypeVP8 = "video/vp8" MimeTypeVP9 = "video/vp9" MimeTypeG722 = "audio/G722" MimeTypePCMU = "audio/PCMU" MimeTypePCMA = "audio/PCMA" )
const ( TypeOpus = 1 TypeVP8 = 2 TypeVP9 = 3 TypeH264 = 4 )
Types for samples
Variables ¶
var ( // ErrCodecNotSupported is returned when a rtp packed it pushed with an unsupported codec ErrCodecNotSupported = errors.New("codec not supported") )
Functions ¶
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder Module for building video/audio samples from rtp streams
func NewBuilder ¶
NewBuilder Initialize a new audio sample builder
func (*Builder) AttachElement ¶
AttachElement attaches a element to a builder
type Config ¶
type Config struct { Log log.Config `mapstructure:"log"` SampleBuilder Samplebuilderconf `mapstructure:"samplebuilder"` WebRTC webrtcconf `mapstructure:"webrtc"` }
Config for base AVP
type ElementFun ¶
ElementFun create a element
type PendingProcess ¶
type PendingProcess struct {
// contains filtered or unexported fields
}
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
func NewPublisher ¶
func NewPublisher(cfg WebRTCTransportConfig) (*Publisher, error)
NewPublisher creates a new Publisher
func (*Publisher) AddICECandidate ¶
AddICECandidate to peer connection
func (*Publisher) CreateOffer ¶
func (*Publisher) OnICECandidate ¶
func (p *Publisher) OnICECandidate(f func(c *webrtc.ICECandidate))
OnICECandidate handler
func (*Publisher) SetRemoteDescription ¶
SetRemoteDescription sets the SessionDescription of the remote peer
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry provides a registry of elements
func (*Registry) AddElement ¶
func (r *Registry) AddElement(eid string, f ElementFun)
AddElement to registry
func (*Registry) GetElement ¶
func (r *Registry) GetElement(id string) ElementFun
GetElement to registry
type SFUFeedback ¶
type Sample ¶
type Sample struct { ID string Type int Timestamp uint32 SequenceNumber uint16 Payload interface{} Level uint8 }
Sample of audio or video
type Samplebuilderconf ¶
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
func NewSubscriber ¶
func NewSubscriber(cfg WebRTCTransportConfig) (*Subscriber, error)
NewSubscriber creates a new Subscriber
func (*Subscriber) AddICECandidate ¶
func (s *Subscriber) AddICECandidate(candidate webrtc.ICECandidateInit) error
AddICECandidate to peer connection
func (*Subscriber) Answer ¶
func (s *Subscriber) Answer(offer webrtc.SessionDescription) (webrtc.SessionDescription, error)
func (*Subscriber) OnICECandidate ¶
func (s *Subscriber) OnICECandidate(f func(c *webrtc.ICECandidate))
OnICECandidate handler
func (*Subscriber) OnTrack ¶
func (s *Subscriber) OnTrack(f func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver))
type WebRTCTransport ¶
type WebRTCTransport struct {
// contains filtered or unexported fields
}
WebRTCTransport represents a webrtc transport
func NewWebRTCTransport ¶
func NewWebRTCTransport(id string, c Config) *WebRTCTransport
NewWebRTCTransport creates a new webrtc transport
func (*WebRTCTransport) AddICECandidate ¶
func (t *WebRTCTransport) AddICECandidate(candidate webrtc.ICECandidateInit, target int) error
AddICECandidate accepts an ICE candidate string and adds it to the existing set of candidates
func (*WebRTCTransport) Answer ¶
func (t *WebRTCTransport) Answer(offer webrtc.SessionDescription) (webrtc.SessionDescription, error)
Answer starts the PeerConnection and generates the localDescription
func (*WebRTCTransport) CreateOffer ¶
func (t *WebRTCTransport) CreateOffer() (webrtc.SessionDescription, error)
CreateOffer starts the PeerConnection and generates the localDescription
func (*WebRTCTransport) OnClose ¶
func (t *WebRTCTransport) OnClose(f func())
OnClose sets a handler that is called when the webrtc transport is closed
func (*WebRTCTransport) OnICECandidate ¶
func (t *WebRTCTransport) OnICECandidate(f func(c *webrtc.ICECandidate, target int))
OnICECandidate sets an event handler which is invoked when a new ICE candidate is found. Take note that the handler is gonna be called with a nil pointer when gathering is finished.
func (*WebRTCTransport) Process ¶
func (t *WebRTCTransport) Process(pid, tid, eid string, config []byte) error
Process creates a pipeline
func (*WebRTCTransport) SetRemoteDescription ¶
func (t *WebRTCTransport) SetRemoteDescription(desc webrtc.SessionDescription) error
SetRemoteDescription sets the SessionDescription of the remote peer
type WebRTCTransportConfig ¶
type WebRTCTransportConfig struct {
// contains filtered or unexported fields
}
WebRTCTransportConfig represents configuration options