avp

package
v1.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2020 License: MIT Imports: 12 Imported by: 6

Documentation

Index

Constants

View Source
const (
	TypeOpus = 1
	TypeVP8  = 2
	TypeVP9  = 3
	TypeH264 = 4
)

Types for samples

Variables

View Source
var (
	// ErrCodecNotSupported is returned when a rtp packed it pushed with an unsupported codec
	ErrCodecNotSupported = errors.New("codec not supported")
)

Functions

func Init

func Init(elems map[string]ElementFun)

Init avp with a registry of elements

Types

type Builder added in v0.1.0

type Builder struct {
	// contains filtered or unexported fields
}

Builder Module for building video/audio samples from rtp streams

func NewBuilder added in v0.1.0

func NewBuilder(track *webrtc.Track, maxLate uint16) *Builder

NewBuilder Initialize a new audio sample builder

func (*Builder) AttachElement added in v0.1.0

func (b *Builder) AttachElement(e Element)

AttachElement attaches a element to a builder

func (*Builder) OnStop added in v1.0.12

func (b *Builder) OnStop(f func())

OnStop is called when a builder is stopped

func (*Builder) Track added in v0.1.0

func (b *Builder) Track() *webrtc.Track

Track returns the builders underlying track

type Config

type Config struct {
	Log           log.Config        `mapstructure:"log"`
	SampleBuilder samplebuilderconf `mapstructure:"samplebuilder"`
	WebRTC        webrtcconf        `mapstructure:"webrtc"`
}

Config for base AVP

type Element

type Element interface {
	Write(*Sample) error
	Attach(Element)
	Close()
}

Element interface

type ElementFun added in v1.0.35

type ElementFun func(sid, pid, tid string, config []byte) Element

ElementFun create a element

type PendingProcess added in v1.0.14

type PendingProcess struct {
	// contains filtered or unexported fields
}

type Publisher added in v1.4.0

type Publisher struct {
	// contains filtered or unexported fields
}

func NewPublisher added in v1.4.0

func NewPublisher(cfg WebRTCTransportConfig) (*Publisher, error)

NewPublisher creates a new Publisher

func (*Publisher) AddICECandidate added in v1.4.0

func (p *Publisher) AddICECandidate(candidate webrtc.ICECandidateInit) error

AddICECandidate to peer connection

func (*Publisher) Close added in v1.4.0

func (p *Publisher) Close() error

Close peer

func (*Publisher) CreateOffer added in v1.4.0

func (p *Publisher) CreateOffer() (webrtc.SessionDescription, error)

func (*Publisher) OnICECandidate added in v1.4.0

func (p *Publisher) OnICECandidate(f func(c *webrtc.ICECandidate))

OnICECandidate handler

func (*Publisher) SetRemoteDescription added in v1.4.0

func (p *Publisher) SetRemoteDescription(desc webrtc.SessionDescription) error

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 NewRegistry

func NewRegistry() *Registry

NewRegistry returns new registry instance

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 added in v1.0.34

type SFUFeedback struct {
	StreamID string `json:"streamId"`
	Video    string `json:"video"`
	Audio    bool   `json:"audio"`
}

type Sample added in v0.1.0

type Sample struct {
	ID             string
	Type           int
	Timestamp      uint32
	SequenceNumber uint16
	Payload        interface{}
}

Sample of audio or video

type Subscriber added in v1.4.0

type Subscriber struct {
	// contains filtered or unexported fields
}

func NewSubscriber added in v1.4.0

func NewSubscriber(cfg WebRTCTransportConfig) (*Subscriber, error)

NewSubscriber creates a new Subscriber

func (*Subscriber) AddICECandidate added in v1.4.0

func (s *Subscriber) AddICECandidate(candidate webrtc.ICECandidateInit) error

AddICECandidate to peer connection

func (*Subscriber) Answer added in v1.4.0

func (s *Subscriber) Answer(offer webrtc.SessionDescription) (webrtc.SessionDescription, error)

func (*Subscriber) Close added in v1.4.0

func (s *Subscriber) Close() error

Close the webrtc transport

func (*Subscriber) OnICECandidate added in v1.4.0

func (s *Subscriber) OnICECandidate(f func(c *webrtc.ICECandidate))

OnICECandidate handler

func (*Subscriber) OnTrack added in v1.4.0

func (s *Subscriber) OnTrack(f func(track *webrtc.Track, 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 added in v1.4.0

func (t *WebRTCTransport) Answer(offer webrtc.SessionDescription) (webrtc.SessionDescription, error)

Answer starts the PeerConnection and generates the localDescription

func (*WebRTCTransport) Close added in v0.1.0

func (t *WebRTCTransport) Close() error

Close the webrtc transport

func (*WebRTCTransport) CreateOffer

func (t *WebRTCTransport) CreateOffer() (webrtc.SessionDescription, error)

CreateOffer starts the PeerConnection and generates the localDescription

func (*WebRTCTransport) OnClose added in v0.1.0

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 added in v0.0.4

type WebRTCTransportConfig struct {
	// contains filtered or unexported fields
}

WebRTCTransportConfig represents configuration options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL