Help us shape the future of Go! Take the 2026 Go Developer Survey

utils

package
v1.13.11 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const RaceEnabled = false

RaceEnabled reports whether the binary was built with the race detector.

Variables

View Source
var (
	ErrInvalidRTPVersion      = errors.New("invalid RTP version")
	ErrRTPPayloadTypeMismatch = errors.New("RTP payload type mismatch")
	ErrRTPSSRCMismatch        = errors.New("RTP SSRC mismatch")
)

Functions

func BroadcastRTP added in v1.13.8

func BroadcastRTP[T interface {
	sender
	rtpWriter[P]
}, P any](d *DownTrackSpreader[T], pkt P, layer int32) int32

BroadcastRTP writes pkt to every down track and returns how many accepted it. Below the threshold it runs on the caller without allocating; above it, the only allocations are the shared state and the worker funcval.

func CodecParametersFuzzySearch added in v1.5.3

func CodecParametersFuzzySearch(needle webrtc.RTPCodecParameters, haystack []webrtc.RTPCodecParameters) (webrtc.RTPCodecParameters, error)

Do a fuzzy find for a codec in the list of codecs Used for lookup up a codec in an existing list to find a match

func FindRTXPayloadType added in v1.8.1

func FindRTXPayloadType(needle webrtc.PayloadType, haystack []webrtc.RTPCodecParameters) webrtc.PayloadType

Given a CodecParameters find the RTX CodecParameters if one exists

func GetHeaderExtensionID added in v1.5.3

func GetHeaderExtensionID(extensions []interceptor.RTPHeaderExtension, extension webrtc.RTPHeaderExtensionCapability) int

GetHeaderExtensionID returns the ID of a header extension, or 0 if not found

func IsSimulcastMode added in v1.9.2

func IsSimulcastMode(m livekit.VideoLayer_Mode) bool

func ValidateRTPPacket added in v1.6.2

func ValidateRTPPacket(pkt *rtp.Packet, expectedPayloadType uint8, expectedSSRC uint32) error

ValidateRTPPacket checks for a valid RTP packet and returns an error if fields are incorrect

Types

type Debouncer added in v1.8.0

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

func NewDebouncer added in v1.8.0

func NewDebouncer(after time.Duration) *Debouncer

func (*Debouncer) Add added in v1.8.0

func (d *Debouncer) Add(f func())

func (*Debouncer) SetDuration added in v1.8.0

func (d *Debouncer) SetDuration(after time.Duration)

type DownTrackSpreader added in v1.9.7

type DownTrackSpreader[T sender] struct {
	// contains filtered or unexported fields
}

func NewDownTrackSpreader added in v1.9.7

func NewDownTrackSpreader[T sender](params DownTrackSpreaderParams) *DownTrackSpreader[T]

func (*DownTrackSpreader[T]) Broadcast added in v1.9.7

func (d *DownTrackSpreader[T]) Broadcast(writer func(T))

func (*DownTrackSpreader[T]) CloseAndGetDownTracks added in v1.13.8

func (d *DownTrackSpreader[T]) CloseAndGetDownTracks() []T

CloseAndGetDownTracks terminally closes the spreader and drains all senders. Once it returns, TryStore will reject every subsequent sender.

func (*DownTrackSpreader[T]) DownTrackCount added in v1.9.7

func (d *DownTrackSpreader[T]) DownTrackCount() int

func (*DownTrackSpreader[T]) Free added in v1.9.7

func (d *DownTrackSpreader[T]) Free(subscriberID livekit.ParticipantID)

func (*DownTrackSpreader[T]) GetDownTracks added in v1.9.7

func (d *DownTrackSpreader[T]) GetDownTracks() []T

func (*DownTrackSpreader[T]) HasDownTrack added in v1.9.7

func (d *DownTrackSpreader[T]) HasDownTrack(subscriberID livekit.ParticipantID) bool

func (*DownTrackSpreader[T]) ResetAndGetDownTracks added in v1.9.7

func (d *DownTrackSpreader[T]) ResetAndGetDownTracks() []T

func (*DownTrackSpreader[T]) SetThreshold added in v1.13.4

func (d *DownTrackSpreader[T]) SetThreshold(threshold int)

func (*DownTrackSpreader[T]) Store added in v1.9.7

func (d *DownTrackSpreader[T]) Store(sender T)

func (*DownTrackSpreader[T]) TryStore added in v1.13.8

func (d *DownTrackSpreader[T]) TryStore(sender T) bool

TryStore stores sender unless the spreader has been terminally closed.

type DownTrackSpreaderParams added in v1.9.7

type DownTrackSpreaderParams struct {
	Threshold int
	Logger    logger.Logger
}

type RangeMap added in v1.5.0

type RangeMap[RT rangeType, VT valueType] struct {
	// contains filtered or unexported fields
}

func NewRangeMap added in v1.5.0

func NewRangeMap[RT rangeType, VT valueType](size int) *RangeMap[RT, VT]

func (*RangeMap[RT, VT]) ClearAndResetValue added in v1.5.0

func (r *RangeMap[RT, VT]) ClearAndResetValue(start RT, val VT)

func (*RangeMap[RT, VT]) DecValue added in v1.5.0

func (r *RangeMap[RT, VT]) DecValue(end RT, dec VT)

func (*RangeMap[RT, VT]) ExcludeRange added in v1.5.0

func (r *RangeMap[RT, VT]) ExcludeRange(startInclusive RT, endExclusive RT) error

func (*RangeMap[RT, VT]) GetValue added in v1.5.0

func (r *RangeMap[RT, VT]) GetValue(key RT) (VT, error)

func (*RangeMap[RT, VT]) MarshalLogObject added in v1.6.2

func (r *RangeMap[RT, VT]) MarshalLogObject(e zapcore.ObjectEncoder) error

Jump to

Keyboard shortcuts

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