fec

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ExtraHeaderSize = 4

ExtraHeaderSize is the size of the extra FEC header in bytes.

Variables

This section is empty.

Functions

func IsControlPacket

func IsControlPacket(p packet.Packet) bool

IsControlPacket checks if a packet is an FEC control packet.

func WriteControlPacket

func WriteControlPacket(destSocketId uint32, ctrl *ControlPacket) packet.Packet

WriteControlPacket builds an FEC control packet and returns it.

Types

type Config

type Config struct {
	Cols   int
	Rows   int
	Layout string // "even" or "staircase"
	ARQ    string // "always", "onreq", "never"
}

Config represents the parsed FEC configuration.

func ParseConfig

func ParseConfig(filterStr string) (Config, error)

ParseConfig parses a packet filter string into an FEC config. Example: "fec,cols:10,rows:5,layout:even"

type ControlPacket

type ControlPacket struct {
	SNBase         uint32
	TimestampRecov uint32
	GroupIndex     int8
	FlagsRecov     uint8
	LengthRecov    uint16
	PayloadRecov   []byte
}

ControlPacket holds the parsed fields of an FEC control packet.

func ParseControlPacket

func ParseControlPacket(p packet.Packet) (*ControlPacket, error)

ParseControlPacket parses a gosrt packet into an FEC ControlPacket.

type Generator

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

Generator is responsible for generating FEC control packets.

func NewGenerator

func NewGenerator(cfg Config) *Generator

NewGenerator creates a new FEC Generator.

func (*Generator) AddPacket

func (g *Generator) AddPacket(p packet.Packet) []packet.Packet

AddPacket processes an outgoing data packet and potentially generates an FEC control packet. Returns a slice of FEC control packets that are ready to be sent.

type Reconstructor

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

Reconstructor is responsible for rebuilding lost packets using FEC control packets.

func NewReconstructor

func NewReconstructor(cfg Config) *Reconstructor

NewReconstructor creates a new FEC Reconstructor.

func (*Reconstructor) AddPacket

func (r *Reconstructor) AddPacket(p packet.Packet) []packet.Packet

AddPacket processes an incoming data packet or FEC control packet. It returns a slice of recovered packets (if any).

Jump to

Keyboard shortcuts

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