Documentation ¶
Overview ¶
Package gcc implements Google Congestion Control for bandwidth estimation
Index ¶
- Variables
- type DelayStats
- type LeakyBucketPacer
- func (p *LeakyBucketPacer) AddStream(ssrc uint32, writer interceptor.RTPWriter)
- func (p *LeakyBucketPacer) Close() error
- func (p *LeakyBucketPacer) Run()
- func (p *LeakyBucketPacer) SetTargetBitrate(rate int)
- func (p *LeakyBucketPacer) Write(header *rtp.Header, payload []byte, attributes interceptor.Attributes) (int, error)
- type LossStats
- type NoOpPacer
- type Option
- type Pacer
- type SendSideBWE
- func (e *SendSideBWE) AddStream(info *interceptor.StreamInfo, writer interceptor.RTPWriter) interceptor.RTPWriter
- func (e *SendSideBWE) Close() error
- func (e *SendSideBWE) GetStats() map[string]interface{}
- func (e *SendSideBWE) GetTargetBitrate() int
- func (e *SendSideBWE) OnTargetBitrateChange(f func(bitrate int))
- func (e *SendSideBWE) WriteRTCP(pkts []rtcp.Packet, _ interceptor.Attributes) error
- type Stats
Constants ¶
This section is empty.
Variables ¶
var ErrSendSideBWEClosed = errors.New("SendSideBwe closed")
ErrSendSideBWEClosed is raised when SendSideBWE.WriteRTCP is called after SendSideBWE.Close
var ErrUnknownStream = errors.New("unknown ssrc")
ErrUnknownStream is returned when trying to send a packet with a SSRC that was never registered with any stream
Functions ¶
This section is empty.
Types ¶
type DelayStats ¶
type DelayStats struct { Measurement time.Duration Estimate time.Duration Threshold time.Duration LastReceiveDelta time.Duration Usage usage State state TargetBitrate int }
DelayStats contains some internal statistics of the delay based congestion controller
type LeakyBucketPacer ¶
type LeakyBucketPacer struct {
// contains filtered or unexported fields
}
LeakyBucketPacer implements a leaky bucket pacing algorithm
func NewLeakyBucketPacer ¶
func NewLeakyBucketPacer(initialBitrate int) *LeakyBucketPacer
NewLeakyBucketPacer initializes a new LeakyBucketPacer
func (*LeakyBucketPacer) AddStream ¶
func (p *LeakyBucketPacer) AddStream(ssrc uint32, writer interceptor.RTPWriter)
AddStream adds a new stream and its corresponding writer to the pacer
func (*LeakyBucketPacer) Close ¶
func (p *LeakyBucketPacer) Close() error
Close closes the LeakyBucketPacer
func (*LeakyBucketPacer) SetTargetBitrate ¶
func (p *LeakyBucketPacer) SetTargetBitrate(rate int)
SetTargetBitrate updates the target bitrate at which the pacer is allowed to send packets. The pacer may exceed this limit by p.f
func (*LeakyBucketPacer) Write ¶
func (p *LeakyBucketPacer) Write(header *rtp.Header, payload []byte, attributes interceptor.Attributes) (int, error)
Write sends a packet with header and payload the a previously registered stream.
type NoOpPacer ¶
type NoOpPacer struct {
// contains filtered or unexported fields
}
NoOpPacer implements a pacer that always immediately sends incoming packets
func (*NoOpPacer) AddStream ¶
func (p *NoOpPacer) AddStream(ssrc uint32, writer interceptor.RTPWriter)
AddStream adds a stream and corresponding writer to the p
func (*NoOpPacer) SetTargetBitrate ¶
SetTargetBitrate sets the bitrate at which the pacer sends data. NoOp for NoOp pacer.
func (*NoOpPacer) Write ¶
func (p *NoOpPacer) Write(header *rtp.Header, payload []byte, attributes interceptor.Attributes) (int, error)
Write sends a packet with header and payload to a previously added stream
type Option ¶
type Option func(*SendSideBWE) error
Option configures a bandwidth estimator
func SendSideBWEInitialBitrate ¶
SendSideBWEInitialBitrate sets the initial bitrate of new GCC interceptors
func SendSideBWEMaxBitrate ¶
SendSideBWEMaxBitrate sets the initial bitrate of new GCC interceptors
func SendSideBWEMinBitrate ¶
SendSideBWEMinBitrate sets the initial bitrate of new GCC interceptors
func SendSideBWEPacer ¶
SendSideBWEPacer sets the pacing algorithm to use.
type Pacer ¶
type Pacer interface { interceptor.RTPWriter AddStream(ssrc uint32, writer interceptor.RTPWriter) SetTargetBitrate(int) Close() error }
Pacer is the interface implemented by packet pacers
type SendSideBWE ¶
type SendSideBWE struct {
// contains filtered or unexported fields
}
SendSideBWE implements a combination of loss and delay based GCC
func NewSendSideBWE ¶
func NewSendSideBWE(opts ...Option) (*SendSideBWE, error)
NewSendSideBWE creates a new sender side bandwidth estimator
func (*SendSideBWE) AddStream ¶
func (e *SendSideBWE) AddStream(info *interceptor.StreamInfo, writer interceptor.RTPWriter) interceptor.RTPWriter
AddStream adds a new stream to the bandwidth estimator
func (*SendSideBWE) Close ¶
func (e *SendSideBWE) Close() error
Close stops and closes the bandwidth estimator
func (*SendSideBWE) GetStats ¶
func (e *SendSideBWE) GetStats() map[string]interface{}
GetStats returns some internal statistics of the bandwidth estimator
func (*SendSideBWE) GetTargetBitrate ¶
func (e *SendSideBWE) GetTargetBitrate() int
GetTargetBitrate returns the current target bitrate in bits per second
func (*SendSideBWE) OnTargetBitrateChange ¶
func (e *SendSideBWE) OnTargetBitrateChange(f func(bitrate int))
OnTargetBitrateChange sets the callback that is called when the target bitrate in bits per second changes
func (*SendSideBWE) WriteRTCP ¶
func (e *SendSideBWE) WriteRTCP(pkts []rtcp.Packet, _ interceptor.Attributes) error
WriteRTCP adds some RTCP feedback to the bandwidth estimator
type Stats ¶
type Stats struct { LossStats DelayStats }
Stats contains internal statistics of the bandwidth estimator