From eec8077eaaae5cfe493091624b29b45be4473a7d Mon Sep 17 00:00:00 2001 From: ypothoma Date: Fri, 3 Nov 2023 18:30:18 -0700 Subject: [PATCH] Fixing linting issues --- pkg/flexfec/encoder_interceptor.go | 6 +++--- pkg/flexfec/flexfec_coverage.go | 2 ++ pkg/flexfec/flexfec_encoder.go | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/flexfec/encoder_interceptor.go b/pkg/flexfec/encoder_interceptor.go index 8587ffb6..22c6850b 100644 --- a/pkg/flexfec/encoder_interceptor.go +++ b/pkg/flexfec/encoder_interceptor.go @@ -16,7 +16,7 @@ type FecInterceptor struct { minNumMediaPackets uint32 } -// Option can be used to set initial options on Fec encoder interceptors. +// FecOption can be used to set initial options on Fec encoder interceptors. type FecOption func(d *FecInterceptor) error // FecInterceptorFactory creates new FecInterceptors. @@ -64,9 +64,9 @@ func (r *FecInterceptor) BindLocalStream(info *interceptor.StreamInfo, writer in fecPackets = r.flexFecEncoder.EncodeFec(r.packetBuffer, 2) for _, fecPacket := range fecPackets { - result, err := writer.Write(&fecPacket.Header, fecPacket.Payload, attributes) + fecResult, fecErr := writer.Write(&fecPacket.Header, fecPacket.Payload, attributes) - if err != nil && result == 0 { + if fecErr != nil && fecResult == 0 { break } } diff --git a/pkg/flexfec/flexfec_coverage.go b/pkg/flexfec/flexfec_coverage.go index 03b4950d..4c05ba9f 100644 --- a/pkg/flexfec/flexfec_coverage.go +++ b/pkg/flexfec/flexfec_coverage.go @@ -145,6 +145,8 @@ func (p *ProtectionCoverage) ExtractMask3(fecPacketIndex uint32) uint64 { return mask3 } +// ExtractMask3 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 (p *ProtectionCoverage) ExtractMask3_03(fecPacketIndex uint32) uint64 { mask := p.packetMasks[fecPacketIndex] // We remove the first 46 bits diff --git a/pkg/flexfec/flexfec_encoder.go b/pkg/flexfec/flexfec_encoder.go index cb0b476d..479832e5 100644 --- a/pkg/flexfec/flexfec_encoder.go +++ b/pkg/flexfec/flexfec_encoder.go @@ -25,7 +25,7 @@ type FlexEncoder interface { EncodeFec(mediaPackets []rtp.Packet, numFecPackets uint32) []rtp.Packet } -// FlexEncoder implements the Fec encoding mechanism for the "Flex" variant of FlexFec. +// FlexEncoder20 implements the Fec encoding mechanism for the "Flex" variant of FlexFec. type FlexEncoder20 struct { fecBaseSn uint16 payloadType uint8