rtcpreceiver

package
v4.16.3 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package rtcpreceiver contains a utility to generate RTCP receiver reports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RTCPReceiver

type RTCPReceiver struct {
	// Track clock rate.
	ClockRate int

	// Local SSRC
	LocalSSRC *uint32

	// Whether the transport is unrealiable.
	// This enables removing duplicate packets and reordering packets.
	UnrealiableTransport bool

	// size of the buffer for reordering packets.
	// It defaults to 64.
	BufferSize int

	// Period of RTCP receiver reports.
	Period time.Duration

	// time.Now function.
	TimeNow func() time.Time

	// Called when a RTCP receiver report is ready to be written.
	WritePacketRTCP func(rtcp.Packet)
	// contains filtered or unexported fields
}

RTCPReceiver is a utility to receive RTP packets. It is in charge of: - removing packets with wrong SSRC - removing duplicate packets (when transport is unreliable) - reordering packets (when transport is unrealiable) - counting lost packets - generating RTCP receiver reports

func New deprecated

func New(
	clockRate int,
	receiverSSRC *uint32,
	period time.Duration,
	timeNow func() time.Time,
	writePacketRTCP func(rtcp.Packet),
) (*RTCPReceiver, error)

New allocates a RTCPReceiver.

Deprecated: replaced by Initialize().

func (*RTCPReceiver) Close

func (rr *RTCPReceiver) Close()

Close closes the RTCPReceiver.

func (*RTCPReceiver) Initialize

func (rr *RTCPReceiver) Initialize() error

Initialize initializes RTCPReceiver.

func (*RTCPReceiver) PacketNTP

func (rr *RTCPReceiver) PacketNTP(ts uint32) (time.Time, bool)

PacketNTP returns the NTP (absolute timestamp) of the packet.

func (*RTCPReceiver) ProcessPacket deprecated

func (rr *RTCPReceiver) ProcessPacket(pkt *rtp.Packet, system time.Time, ptsEqualsDTS bool) error

ProcessPacket extracts the needed data from RTP packets.

Deprecated: replaced by ProcessPacket2.

func (*RTCPReceiver) ProcessPacket2

func (rr *RTCPReceiver) ProcessPacket2(
	pkt *rtp.Packet,
	system time.Time,
	ptsEqualsDTS bool,
) ([]*rtp.Packet, uint64, error)

ProcessPacket2 processes an incoming RTP packet. It returns reordered packets and number of lost packets.

func (*RTCPReceiver) ProcessSenderReport

func (rr *RTCPReceiver) ProcessSenderReport(sr *rtcp.SenderReport, system time.Time)

ProcessSenderReport processes an incoming RTCP sender report.

func (*RTCPReceiver) SenderSSRC deprecated

func (rr *RTCPReceiver) SenderSSRC() (uint32, bool)

SenderSSRC returns the SSRC of incoming RTP packets.

Deprecated: replaced by Stats().

func (*RTCPReceiver) Stats

func (rr *RTCPReceiver) Stats() *Stats

Stats returns statistics.

type Stats

type Stats struct {
	RemoteSSRC         uint32
	LastSequenceNumber uint16
	LastRTP            uint32
	LastNTP            time.Time
	Jitter             float64
}

Stats are statistics.

Jump to

Keyboard shortcuts

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