Documentation
¶
Overview ¶
Package flexfec implements FlexFEC to recover missing RTP packets due to packet loss. https://datatracker.ietf.org/doc/html/rfc8627
Index ¶
- Constants
- type FlexEncoder
- type ProtectionCoverage
- func (p *ProtectionCoverage) ExtractMask1(fecPacketIndex uint32) uint16
- func (p *ProtectionCoverage) ExtractMask2(fecPacketIndex uint32) uint32
- func (p *ProtectionCoverage) ExtractMask3(fecPacketIndex uint32) uint64
- func (p *ProtectionCoverage) GetCoveredBy(fecPacketIndex uint32) *util.MediaPacketIterator
- func (p *ProtectionCoverage) MarshalBitmasks(fecPacketIndex uint32) []byte
- func (p *ProtectionCoverage) ResetCoverage()
Constants ¶
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
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.
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.