plugins

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeJitterBuffer = "JitterBuffer"
	TypeRTPForwarder = "RTPForwarder"
)

Variables

This section is empty.

Functions

func CheckPlugins added in v0.2.0

func CheckPlugins(config Config) error

func IsVP8KeyFrame

func IsVP8KeyFrame(pkt *rtp.Packet) bool

IsVP8KeyFrame check key frame

Types

type Buffer

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

Buffer contains all packets

func NewBuffer

func NewBuffer(o BufferOptions) *Buffer

NewBuffer constructs a new Buffer

func (*Buffer) FindPacket added in v0.2.0

func (b *Buffer) FindPacket(sn uint16) *rtp.Packet

FindPacket find packet from buffer

func (*Buffer) GetLostRateBandwidth added in v0.2.0

func (b *Buffer) GetLostRateBandwidth(cycle uint64) (float64, uint64)

GetLostRateBandwidth calc lostRate and bandwidth by cycle

func (*Buffer) GetNackPair added in v0.2.0

func (b *Buffer) GetNackPair(buffer [65536]*rtp.Packet, begin, end uint16) (rtcp.NackPair, int)

GetNackPair calc nackpair

func (*Buffer) GetPacket

func (b *Buffer) GetPacket(sn uint16) *rtp.Packet

GetPacket get packet by sequence number

func (*Buffer) GetPayloadType

func (b *Buffer) GetPayloadType() uint8

GetPayloadType get payloadtype

func (*Buffer) GetRTCPChan

func (b *Buffer) GetRTCPChan() chan rtcp.Packet

GetRTCPChan return rtcp channel

func (*Buffer) GetSSRC

func (b *Buffer) GetSSRC() uint32

GetSSRC get ssrc

func (*Buffer) GetStat

func (b *Buffer) GetStat() string

GetStat get status from buffer

func (*Buffer) Push

func (b *Buffer) Push(p *rtp.Packet)

Push adds a RTP Packet, out of order, new packet may be arrived later

func (*Buffer) SetSSRCPT

func (b *Buffer) SetSSRCPT(ssrc uint32, pt uint8)

SetSSRCPT set ssrc payloadtype

func (*Buffer) Stop

func (b *Buffer) Stop()

Stop buffer

type BufferOptions added in v0.4.2

type BufferOptions struct {
	TCCOn      bool
	BufferTime int
}

type Config added in v0.2.0

type Config struct {
	On           bool
	JitterBuffer JitterBufferConfig
	RTPForwarder RTPForwarderConfig
}

type JitterBuffer

type JitterBuffer struct {
	Pub transport.Transport
	// contains filtered or unexported fields
}

JitterBuffer core buffer module

func NewJitterBuffer

func NewJitterBuffer(config JitterBufferConfig) *JitterBuffer

NewJitterBuffer return new JitterBuffer

func (*JitterBuffer) AddBuffer

func (j *JitterBuffer) AddBuffer(ssrc uint32) *Buffer

AddBuffer add a buffer by ssrc

func (*JitterBuffer) AttachPub added in v0.2.0

func (j *JitterBuffer) AttachPub(t transport.Transport)

AttachPub Attach pub stream

func (*JitterBuffer) GetBuffer

func (j *JitterBuffer) GetBuffer(ssrc uint32) *Buffer

GetBuffer get a buffer by ssrc

func (*JitterBuffer) GetBuffers

func (j *JitterBuffer) GetBuffers() map[uint32]*Buffer

GetBuffers get all buffers

func (*JitterBuffer) GetPacket

func (j *JitterBuffer) GetPacket(ssrc uint32, sn uint16) *rtp.Packet

GetPacket get packet from buffer

func (*JitterBuffer) ID

func (j *JitterBuffer) ID() string

ID return id

func (*JitterBuffer) Init

func (j *JitterBuffer) Init(config JitterBufferConfig)

Init jitterbuffer config

func (*JitterBuffer) ReadRTP added in v0.2.0

func (j *JitterBuffer) ReadRTP() <-chan *rtp.Packet

ReadRTP return the last packet

func (*JitterBuffer) Stat

func (j *JitterBuffer) Stat() string

Stat get stat from buffers

func (*JitterBuffer) Stop

func (j *JitterBuffer) Stop()

Stop stop all buffer

func (*JitterBuffer) WriteRTP added in v0.2.0

func (j *JitterBuffer) WriteRTP(pkt *rtp.Packet) error

WriteRTP push rtp packet which from pub

type JitterBufferConfig added in v0.2.0

type JitterBufferConfig struct {
	ID            string
	On            bool
	TCCOn         bool
	REMBCycle     int
	PLICycle      int
	MaxBandwidth  int
	MaxBufferTime int
}

JitterBufferConfig .

type Plugin added in v0.2.0

type Plugin interface {
	ID() string
	WriteRTP(*rtp.Packet) error
	ReadRTP() <-chan *rtp.Packet
	Stop()
}

Plugin some interfaces

type PluginChain added in v0.2.0

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

func NewPluginChain added in v0.2.0

func NewPluginChain(mid string) *PluginChain

func (*PluginChain) AddPlugin added in v0.2.0

func (p *PluginChain) AddPlugin(id string, i Plugin)

AddPlugin add a plugin

func (*PluginChain) AttachPub added in v0.2.0

func (p *PluginChain) AttachPub(pub transport.Transport)

func (*PluginChain) Close added in v0.2.0

func (p *PluginChain) Close()

func (*PluginChain) DelPlugin added in v0.2.0

func (p *PluginChain) DelPlugin(id string)

DelPlugin del plugin

func (*PluginChain) DelPluginChain added in v0.2.0

func (p *PluginChain) DelPluginChain()

DelPluginChain del all plugins

func (*PluginChain) GetPlugin added in v0.2.0

func (p *PluginChain) GetPlugin(id string) Plugin

GetPlugin get plugin by id

func (*PluginChain) GetPluginsTotal added in v0.2.0

func (p *PluginChain) GetPluginsTotal() int

GetPluginsTotal get plugin total count

func (*PluginChain) Init added in v0.2.0

func (p *PluginChain) Init(config Config) error

func (*PluginChain) On added in v0.2.0

func (p *PluginChain) On() bool

func (*PluginChain) ReadRTP added in v0.2.0

func (p *PluginChain) ReadRTP() *rtp.Packet

type RTPForwarder added in v0.3.0

type RTPForwarder struct {
	Transport *transport.RTPTransport
	// contains filtered or unexported fields
}

RTPForwarder core

func NewRTPForwarder added in v0.3.0

func NewRTPForwarder(config RTPForwarderConfig) *RTPForwarder

NewRTPForwarder Create new RTP Forwarder

func (*RTPForwarder) ID added in v0.3.0

func (r *RTPForwarder) ID() string

ID Return RTPForwarder ID

func (*RTPForwarder) ReadRTP added in v0.3.0

func (r *RTPForwarder) ReadRTP() <-chan *rtp.Packet

ReadRTP Forward rtp packet which from pub

func (*RTPForwarder) Stop added in v0.3.0

func (r *RTPForwarder) Stop()

Stop Stop plugin

func (*RTPForwarder) WriteRTP added in v0.3.0

func (r *RTPForwarder) WriteRTP(pkt *rtp.Packet) error

WriteRTP Forward rtp packet which from pub

type RTPForwarderConfig added in v0.3.0

type RTPForwarderConfig struct {
	ID      string
	MID     string
	On      bool
	Addr    string
	KcpKey  string
	KcpSalt string
}

RTPForwarderConfig .

Jump to

Keyboard shortcuts

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