Documentation ¶
Overview ¶
Package flexfec implements FlexFEC to recover missing RTP packets due to packet loss. https://datatracker.ietf.org/doc/html/rfc8627
Package flexfec implements FlexFEC to recover missing RTP packets due to packet loss. https://datatracker.ietf.org/doc/html/rfc8627
Index ¶
- Constants
- type FecInterceptor
- type FecInterceptorFactory
- type FecOption
- type FlexEncoder
- type FlexEncoder03
- type FlexEncoder20
- 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) ExtractMask3_03(fecPacketIndex uint32) uint64
- func (p *ProtectionCoverage) GetCoveredBy(fecPacketIndex uint32) *util.MediaPacketIterator
- func (p *ProtectionCoverage) UpdateCoverage(mediaPackets []rtp.Packet, numFecPackets uint32)
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 )
const ( // BaseFec03HeaderSize represents the minium FEC payload's header size including the // required first mask. BaseFec03HeaderSize = 20 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FecInterceptor ¶
type FecInterceptor struct { interceptor.NoOp // contains filtered or unexported fields }
FecInterceptor implements FlexFec.
func (*FecInterceptor) BindLocalStream ¶
func (r *FecInterceptor) BindLocalStream(info *interceptor.StreamInfo, writer interceptor.RTPWriter) interceptor.RTPWriter
BindLocalStream lets you modify any outgoing RTP packets. It is called once for per LocalStream. The returned method will be called once per rtp packet.
type FecInterceptorFactory ¶
type FecInterceptorFactory struct {
// contains filtered or unexported fields
}
FecInterceptorFactory creates new FecInterceptors.
func NewFecInterceptor ¶
func NewFecInterceptor(opts ...FecOption) (*FecInterceptorFactory, error)
NewFecInterceptor returns a new Fec interceptor factory.
func (*FecInterceptorFactory) NewInterceptor ¶
func (r *FecInterceptorFactory) NewInterceptor(_ string) (interceptor.Interceptor, error)
NewInterceptor constructs a new FecInterceptor.
type FecOption ¶
type FecOption func(d *FecInterceptor) error
FecOption can be used to set initial options on Fec encoder interceptors.
type FlexEncoder ¶
type FlexEncoder interface {
EncodeFec(mediaPackets []rtp.Packet, numFecPackets uint32) []rtp.Packet
}
FlexEncoder is the interface that FecInterceptor uses to encode Fec packets.
type FlexEncoder03 ¶
type FlexEncoder03 struct {
// contains filtered or unexported fields
}
FlexEncoder03 implements the Fec encoding mechanism for the "Flex" variant of FlexFec.
func NewFlexEncoder03 ¶
func NewFlexEncoder03(payloadType uint8, ssrc uint32) *FlexEncoder03
NewFlexEncoder03 returns a new FlexFecEncoder.
type FlexEncoder20 ¶
type FlexEncoder20 struct {
// contains filtered or unexported fields
}
FlexEncoder20 implements the Fec encoding mechanism for the "Flex" variant of FlexFec.
func NewFlexEncoder ¶
func NewFlexEncoder(payloadType uint8, ssrc uint32) *FlexEncoder20
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) ExtractMask3_03 ¶
func (p *ProtectionCoverage) ExtractMask3_03(fecPacketIndex uint32) uint64
ExtractMask3_03 returns the third section of the bitmask as defined by the FEC header. https://datatracker.ietf.org/doc/html/draft-ietf-payload-flexible-fec-scheme-03#section-4.2
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) UpdateCoverage ¶
func (p *ProtectionCoverage) UpdateCoverage(mediaPackets []rtp.Packet, numFecPackets uint32)
UpdateCoverage updates the ProtectionCoverage object with new bitmasks accounting for the numFecPackets we want to use to protect the batch media packets.