remb

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitializationTime          = 5000 // 5s
	FrameInterval               = 1000 / 30
	PacketSize                  = 1200
	MinIncreaseRateBpsPerSecond = 4000
	DefaultRTT                  = 200
)
View Source
const (
	RcHold     = 0
	RcIncrease = 1
	RcDecrease = 2

	MinPeriod     = Second * 2
	DefaultPeriod = Second * 3
	MaxPeriod     = Second * 50
)
View Source
const (
	BitPerSecond      Bitrate = 1
	BytePerSecond             = 8 * BitPerSecond
	KilobitsPerSecond         = 1000 * BitPerSecond
)
View Source
const (
	Microsecond Duration = 1 // 1μs
	Millisecond          = 1000 * Microsecond
	Second               = 1000 * Millisecond
	Minute               = 60 * Second
)
View Source
const (
	Normal     = 0
	Overusing  = 1
	Underusing = 2
)
View Source
const (
	MaxNumDeltas     = 60
	MaxAdaptOffsetMs = 15.0
)
View Source
const (
	DeltaCounterMax             = 1000
	MinFramePeriodHistoryLength = 60
)
View Source
const (
	AbsSendTimeInterArrivalUpshift = 8
	UnlimitedRembNumPackets        = 4
	StreamTimeOutMs                = 2000
	InitialProbingIntervalMs       = 2000
	AbsSendTimeFraction            = 18
	InterArrivalShift              = AbsSendTimeFraction + AbsSendTimeInterArrivalUpshift
	MaxProbePackets                = 15
	TimestampGroupLengthMs         = 5
	TimestampToMs                  = 1000.0 / (1 << InterArrivalShift)
)
View Source
const (
	BitrateWindowMs        = 1000
	NoUpdate               = 0
	Update                 = 1
	ExpectedNumberOfProbes = 3
	MinClusterDelta        = 1
	MinClusterSize         = 4
)
View Source
const (
	LimitNumPackets = 20
)

Variables

This section is empty.

Functions

func NewReceiver

func NewReceiver(id uint8, sendRtcp func(packet rtcp.Packet)) *receiver

NewReceiver RemoteBitrate Estimator https://datatracker.ietf.org/doc/html/draft-alvestrand-rmcat-congestion-03

func NewSender

func NewSender(initialBitrate uint64) *sender

Types

type AimdRateControl

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

func NewAimdRateControl

func NewAimdRateControl() *AimdRateControl

func (*AimdRateControl) FeedbackInterval

func (c *AimdRateControl) FeedbackInterval() Duration

func (*AimdRateControl) GetExpectedBandwidthPeriod

func (c *AimdRateControl) GetExpectedBandwidthPeriod() Duration

func (*AimdRateControl) LatestEstimate

func (c *AimdRateControl) LatestEstimate() Bitrate

func (*AimdRateControl) SetEstimate

func (c *AimdRateControl) SetEstimate(bitrate Bitrate, now int64)

func (*AimdRateControl) SetStartBitrate

func (c *AimdRateControl) SetStartBitrate(startBitrate Bitrate)

func (*AimdRateControl) TimeToReduceFurther

func (c *AimdRateControl) TimeToReduceFurther(ms int64, rate Bitrate) bool

func (*AimdRateControl) Update

func (c *AimdRateControl) Update(input RateControllerInput, now int64) Bitrate

func (*AimdRateControl) ValidEstimate

func (c *AimdRateControl) ValidEstimate() bool

type Bitrate

type Bitrate uint64

Bitrate bits per second

func NewBitrate

func NewBitrate(byteSize int64, duration Duration) Bitrate

Byte count

func (Bitrate) For

func (b Bitrate) For(duration Duration) DataSize

func (Bitrate) For2

func (b Bitrate) For2(duration time.Duration) DataSize

func (Bitrate) String

func (b Bitrate) String() string

type Clock

type Clock interface {
	NowMs() int64 // Return current timestamp in ms.
}

type Cluster

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

func (*Cluster) RecvBitrate

func (c *Cluster) RecvBitrate() Bitrate

func (*Cluster) SendBitrate

func (c *Cluster) SendBitrate() Bitrate

type DataSize

type DataSize int64

type Duration

type Duration int64 // μs

type LinkCapacityEstimator

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

func NewLinkCapacityEstimator

func NewLinkCapacityEstimator() *LinkCapacityEstimator

func (*LinkCapacityEstimator) Estimate

func (l *LinkCapacityEstimator) Estimate() Bitrate

func (*LinkCapacityEstimator) HasEstimate

func (l *LinkCapacityEstimator) HasEstimate() bool

func (*LinkCapacityEstimator) LowerBound

func (l *LinkCapacityEstimator) LowerBound() Bitrate

func (*LinkCapacityEstimator) OnOveruseDetected

func (l *LinkCapacityEstimator) OnOveruseDetected(throughput Bitrate)

func (*LinkCapacityEstimator) Reset

func (l *LinkCapacityEstimator) Reset()

func (*LinkCapacityEstimator) UpperBound

func (l *LinkCapacityEstimator) UpperBound() Bitrate

type LinkCapacityTracker

type LinkCapacityTracker struct{}

type NetworkStateEstimate

type NetworkStateEstimate struct {
}

Not implements.

func (*NetworkStateEstimate) LinkCapacityLower

func (e *NetworkStateEstimate) LinkCapacityLower() Bitrate

type OveruseDetector

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

func NewOveruseDetector

func NewOveruseDetector() *OveruseDetector

func (*OveruseDetector) Detect

func (d *OveruseDetector) Detect(offset float64, tsDelta uint32, numOfDeltas int, nowMs int64) int

func (*OveruseDetector) State

func (d *OveruseDetector) State() int

type OveruseEstimator

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

func NewOveruseEstimator

func NewOveruseEstimator() *OveruseEstimator

func (*OveruseEstimator) NumOfDeltas

func (e *OveruseEstimator) NumOfDeltas() int

func (*OveruseEstimator) Offset

func (e *OveruseEstimator) Offset() float64

func (*OveruseEstimator) Update

func (e *OveruseEstimator) Update(tDelta int64, tsDelta uint32, sizeDelta int, currentHypothesis int, nowMs int64)

type Probe

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

type RateControllerInput

type RateControllerInput struct {
	State               int
	EstimatedThroughput *Bitrate
}

type RateStatistics

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

func NewRateStatistics

func NewRateStatistics(windowSizeMs int64, scale float64) *RateStatistics

NewRateStatistics return a new RateStatistics. windowSizeMs: the calculate window. scale: the input size with bit and ms.

func (*RateStatistics) Rate

func (r *RateStatistics) Rate(nowMs int64) *Bitrate

The Rate will return bit per second based on arrived time. The logic is quite simple, allPayloadSize / windowTime is the bitrate

func (*RateStatistics) Reset

func (r *RateStatistics) Reset()

func (*RateStatistics) Update

func (r *RateStatistics) Update(payloadSize int64, nowMs int64)

type SendSideBandwidthEstimation

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

func NewSendSideBandwidthEstimation

func NewSendSideBandwidthEstimation() *SendSideBandwidthEstimation

func (*SendSideBandwidthEstimation) UpdatePacketsLost

func (e *SendSideBandwidthEstimation) UpdatePacketsLost(packetsLost, numberOfPackets, nowMs int64)

func (*SendSideBandwidthEstimation) UpdateReceiverEstimate

func (e *SendSideBandwidthEstimation) UpdateReceiverEstimate(nowMs int64, bitrate uint64)

type SimulatedClock

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

func (*SimulatedClock) Add

func (c *SimulatedClock) Add(duration Duration)

func (*SimulatedClock) NowMs

func (c *SimulatedClock) NowMs() int64

Jump to

Keyboard shortcuts

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