flexfec

package
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: MIT Imports: 3 Imported by: 12

Documentation

Overview

Package flexfec implements FlexFEC to recover missing RTP packets due to packet loss. https://datatracker.ietf.org/doc/html/rfc8627

Index

Constants

View Source
const (
	MaxMediaPackets uint32 = 110
	MaxFecPackets   uint32 = MaxMediaPackets
)

Maximum number of media packets that can be protected by a single FEC packet. We are not supporting the possibility of having an FEC packet protect multiple SSRC source packets for now. https://datatracker.ietf.org/doc/html/rfc8627#section-4.2.2.1

View Source
const (
	// BaseRTPHeaderSize represents the minium RTP packet header size in bytes.
	BaseRTPHeaderSize = 12
	// BaseFecHeaderSize represents the minium FEC payload's header size including the
	// required first mask.
	BaseFecHeaderSize = 12
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FlexEncoder

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

FlexEncoder implements the Fec encoding mechanism for the "Flex" variant of FlexFec.

func NewFlexEncoder

func NewFlexEncoder(baseSN uint16, payloadType uint8, ssrc uint32) *FlexEncoder

NewFlexEncoder returns a new FlexFecEncer.

func (*FlexEncoder) EncodeFec

func (flex *FlexEncoder) EncodeFec(mediaPackets []rtp.Packet, numFecPackets uint32) []rtp.Packet

EncodeFec returns a list of generated RTP packets with FEC payloads that protect the specified mediaPackets. This method does not account for missing RTP packets in the mediaPackets array nor does it account for them being passed out of order.

type ProtectionCoverage

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

ProtectionCoverage defines the map of RTP packets that individual Fec packets protect.

func NewCoverage

func NewCoverage(mediaPackets []rtp.Packet, numFecPackets uint32) *ProtectionCoverage

NewCoverage returns a new ProtectionCoverage object. numFecPackets represents the number of Fec packets that we will be generating to cover the list of mediaPackets. This allows us to know how big the underlying map should be.

func (*ProtectionCoverage) ExtractMask1

func (p *ProtectionCoverage) ExtractMask1(fecPacketIndex uint32) uint16

ExtractMask1 returns the first section of the bitmask as defined by the FEC header. https://datatracker.ietf.org/doc/html/rfc8627#section-4.2.2.1

func (*ProtectionCoverage) ExtractMask2

func (p *ProtectionCoverage) ExtractMask2(fecPacketIndex uint32) uint32

ExtractMask2 returns the second section of the bitmask as defined by the FEC header. https://datatracker.ietf.org/doc/html/rfc8627#section-4.2.2.1

func (*ProtectionCoverage) ExtractMask3

func (p *ProtectionCoverage) ExtractMask3(fecPacketIndex uint32) uint64

ExtractMask3 returns the third section of the bitmask as defined by the FEC header. https://datatracker.ietf.org/doc/html/rfc8627#section-4.2.2.1

func (*ProtectionCoverage) GetCoveredBy

func (p *ProtectionCoverage) GetCoveredBy(fecPacketIndex uint32) *util.MediaPacketIterator

GetCoveredBy returns an iterator over RTP packets that are protected by the specified Fec packet index.

func (*ProtectionCoverage) MarshalBitmasks

func (p *ProtectionCoverage) MarshalBitmasks(fecPacketIndex uint32) []byte

MarshalBitmasks returns the underlying bitmask that defines which media packets are protected by the specified fecPacketIndex.

func (*ProtectionCoverage) ResetCoverage

func (p *ProtectionCoverage) ResetCoverage()

ResetCoverage clears the underlying map so that we can reuse it for new batches of RTP packets.

Directories

Path Synopsis
Package util implements utilities to better support Fec decoding / encoding.
Package util implements utilities to better support Fec decoding / encoding.

Jump to

Keyboard shortcuts

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