Skip to content

Commit

Permalink
Fixing linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pougetat committed Oct 24, 2023
1 parent ef719b2 commit d9bba33
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions pkg/flexfec/flexfec_encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,22 @@ import (
)

const (
// BaseRtpHeaderSize represents the minium RTP packet header size in bytes.
BaseRtpHeaderSize = 12

Check failure on line 17 in pkg/flexfec/flexfec_encoder.go

View workflow job for this annotation

GitHub Actions / lint / Go

ST1003: const BaseRtpHeaderSize should be BaseRTPHeaderSize (stylecheck)
// BaseFecHeaderSize represents the minium FEC payload's header size including the
// required first mask.
BaseFecHeaderSize = 12
)

// FlexFecEncoder implements the Fec encoding mechanism for the "Flex" variant of FlexFec.
type FlexFecEncoder struct {

Check warning on line 24 in pkg/flexfec/flexfec_encoder.go

View workflow job for this annotation

GitHub Actions / lint / Go

exported: type name will be used as flexfec.FlexFecEncoder by other packages, and that stutters; consider calling this Encoder (revive)
baseSN uint16
payloadType uint8
ssrc uint32
coverage *ProtectionCoverage
}

// NewFlexFecEncoder returns a new FlexFecEncer.
func NewFlexFecEncoder(baseSN uint16, payloadType uint8, ssrc uint32) *FlexFecEncoder {
return &FlexFecEncoder{
baseSN: baseSN,
Expand All @@ -33,8 +38,9 @@ func NewFlexFecEncoder(baseSN uint16, payloadType uint8, ssrc uint32) *FlexFecEn
}
}

// Returns the array of FEC packets protecting mediaPkts specified as parameter.
// Encoding will be skipped if there are missing Media packets.
// 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.
func (flex *FlexFecEncoder) EncodeFec(mediaPackets []rtp.Packet, numFecPackets uint32) []rtp.Packet {
// Start by defining which FEC packets cover which media packets
if flex.coverage == nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/flexfec/util/bitarray.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type BitArray struct {
// NewBitArray returns a new BitArray. It takes sizeBits as parameter which represents
// the size of the underlying bitmask.
func NewBitArray(sizeBits uint32) BitArray {
sizeBytes := uint32(0)
var sizeBytes uint32
if sizeBits%8 == 0 {
sizeBytes = sizeBits / 8
} else {
Expand Down
1 change: 1 addition & 0 deletions pkg/flexfec/util/media_packet_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func (m *MediaPacketIterator) Next() *rtp.Packet {
return &packet
}

// First returns the first media packet to iterate through.
func (m *MediaPacketIterator) First() *rtp.Packet {
return &m.mediaPackets[0]
}

0 comments on commit d9bba33

Please sign in to comment.