utils

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NackPairs

func NackPairs(seqNums []uint16) []rtcp.NackPair

func NackPairsToSequenceNumbers

func NackPairsToSequenceNumbers(pairs []rtcp.NackPair) []uint16

Types

type ConnectionState

type ConnectionState int

ConnectionState represents a normalized connection state across different media/WebRTC adapters

const (
	ConnectionStateNew ConnectionState = iota
	ConnectionStateConnecting
	ConnectionStateConnected
	ConnectionStateDisconnected
	ConnectionStateFailed
	ConnectionStateClosed
)

func NormalizeLiveKitDisconnectReason

func NormalizeLiveKitDisconnectReason(reason lksdk.DisconnectionReason) ConnectionState

NormalizeLiveKitDisconnectReason converts a LiveKit DisconnectionReason to ConnectionState

func NormalizeWebRTCState

func NormalizeWebRTCState(state webrtc.ICEConnectionState) ConnectionState

NormalizeWebRTCState converts a pion/webrtc ICEConnectionState to ConnectionState

func (ConnectionState) IsTerminalState

func (s ConnectionState) IsTerminalState() bool

IsTerminalState returns true if the connection state is terminal (failed or closed)

func (ConnectionState) String

func (s ConnectionState) String() string

type JitterBuffer

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

func NewJitterBuffer

func NewJitterBuffer(
	size uint16,
	packetTimeout uint16,
	ctx context.Context,
) *JitterBuffer

func (*JitterBuffer) Add

func (s *JitterBuffer) Add(seq int64, packet *rtp.Packet) bool

func (*JitterBuffer) GetAndClearLastSkipped

func (s *JitterBuffer) GetAndClearLastSkipped() (int64, bool)

func (*JitterBuffer) GetNextStart

func (s *JitterBuffer) GetNextStart() int64

func (*JitterBuffer) NextPackets

func (s *JitterBuffer) NextPackets() ([]*rtp.Packet, bool)

func (*JitterBuffer) SetNextPacketsStart

func (s *JitterBuffer) SetNextPacketsStart(nextPacketsStart int64)

func (*JitterBuffer) SkipPacket

func (s *JitterBuffer) SkipPacket(seq int64)

SkipPacket forces the jitter buffer to skip waiting for a specific sequence number

type ReceiveLog

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

func NewReceiveLog

func NewReceiveLog(size uint16) (*ReceiveLog, error)

func (*ReceiveLog) Add

func (s *ReceiveLog) Add(seq uint16)

func (*ReceiveLog) Get

func (s *ReceiveLog) Get(seq uint16) bool

func (*ReceiveLog) GetLastConsecutive

func (s *ReceiveLog) GetLastConsecutive() uint16

func (*ReceiveLog) IgnoreSeqNum

func (s *ReceiveLog) IgnoreSeqNum(seq uint16)

func (*ReceiveLog) MissingSeqNumbers

func (s *ReceiveLog) MissingSeqNumbers(skipLastN uint16) []uint16

type SendBuffer

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

func NewSendBuffer

func NewSendBuffer(size uint16) (*SendBuffer, error)

func (*SendBuffer) Add

func (s *SendBuffer) Add(packet *rtp.Packet)

func (*SendBuffer) Get

func (s *SendBuffer) Get(seq uint16) *rtp.Packet

type SequenceUnwrapper

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

func NewSequenceUnwrapper

func NewSequenceUnwrapper(base int) *SequenceUnwrapper

func (*SequenceUnwrapper) Unwrap

func (sw *SequenceUnwrapper) Unwrap(n uint64) int64

Unwrap accepts a uint<base> values which form a sequence, and converts the values into int64 while adjusting the sequence every time a wraparound happens. For example: unwrapper := NewSequenceUnwrapper(16) ... unwrapper.Unwrap(65534) == 65534 unwrapper.Unwrap(65535) == 65535 unwrapper.Unwrap(0) == 65536 unwrapper.Unwrap(1) == 65537 ... unwrapper.Unwrap(65534) == 131070 unwrapper.Unwrap(65535) == 131071 unwrapper.Unwrap(0) == 131072 unwrapper.Unwrap(1) == 131073 ...

Jump to

Keyboard shortcuts

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