rtpfb

package
v0.1.44 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package rtpfb implements feedback aggregation for CCFB and TWCC packets.

Index

Constants

View Source
const CCFBAttributesKey ccfbAttributesKeyType = iota

CCFBAttributesKey is the key which can be used to retrieve the Report objects from the interceptor.Attributes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interceptor

type Interceptor struct {
	interceptor.NoOp
	// contains filtered or unexported fields
}

Interceptor implements a congestion control feedback receiver. It keeps track of outgoing packets and reads incoming feedback reports (CCFB or TWCC). For each incoming feedback report, it will add an entry to the interceptor attributes, which can be read from the `RTCPReader` (`webrtc.RTPSender.Read`). For each acknowledgement included in the feedback report, a PacketReport will be added to the ccfb.Report.

func (*Interceptor) BindLocalStream

func (i *Interceptor) BindLocalStream(
	info *interceptor.StreamInfo,
	writer interceptor.RTPWriter,
) interceptor.RTPWriter

BindLocalStream implements interceptor.Interceptor.

func (*Interceptor) BindRTCPReader

func (i *Interceptor) BindRTCPReader(reader interceptor.RTCPReader) interceptor.RTCPReader

BindRTCPReader implements interceptor.Interceptor.

type InterceptorFactory

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

InterceptorFactory is a factory for CCFB interceptors.

func NewInterceptor

func NewInterceptor(opts ...Option) (*InterceptorFactory, error)

NewInterceptor returns a new CCFB InterceptorFactory.

func (*InterceptorFactory) NewInterceptor

func (f *InterceptorFactory) NewInterceptor(_ string) (interceptor.Interceptor, error)

NewInterceptor returns a new ccfb.Interceptor.

type Option

type Option func(*Interceptor) error

Option can be used to set initial options on CCFB interceptors.

func WithLoggerFactory

func WithLoggerFactory(lf logging.LoggerFactory) Option

type PacketReport

type PacketReport struct {
	// SSRC of the stream the packet was sent on.
	SSRC uint32

	// Sequence number of the packet generated by the rtpfb.Interceptor. The
	// sequence number increases by 1 for every outgoing packet independent of
	// the stream it is sent on.
	SequenceNumber uint64

	// Sequence number from the RTP header.
	RTPSequenceNumber uint16

	// IsTWCC is true if the packet was tracked by the
	// transport-wide-congestion-control header extension instead of the
	// combination of SSRC and RTPSequenceNumber.
	IsTWCC bool

	// Sequence number from the transport-wide-congestion-control header
	// extension.
	TWCCSequenceNumber uint16

	// Size is the size of the packet in bytes.
	Size int

	// Arrived indicates if the packet arrived at the receiver. False does not
	// necessarily mean the packet was lost, it might still be in transit.
	Arrived bool

	// Departure is the departure time of the packet taken at the sender. It
	// should be the time measured at the latest possible moment before sending
	// the packet.
	Departure time.Time

	// Arrival is the arrival time of the packet at the receiver. Arrival and
	// Departure do not require synchronized clocks and can therefore not
	// directly be compared.
	Arrival time.Time

	// ECN marking of the packet when it arrived.
	ECN rtcp.ECN
}

type Report

type Report struct {
	Arrival       time.Time
	RTT           time.Duration
	PacketReports []PacketReport
}

A Report contains the Arrival time of a CCFB or TWCC packet, the estimated RTT based on the feedback packet and a list of PacketReport for all acknowledged packets that were still in the history and not yet included in an earlier Report.

Jump to

Keyboard shortcuts

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