Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions header.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ func (h Header) Marshal() ([]byte, error) {
if h.Count > 31 {
return nil, errInvalidHeader
}
rawPacket[0] |= h.Count << countShift
rawPacket[0] |= h.Count << countShift //nolint:gosec // rawPacket is created with length headerLength (4)

rawPacket[1] = uint8(h.Type)
rawPacket[1] = uint8(h.Type) //nolint:gosec // rawPacket is created with length headerLength (4)

binary.BigEndian.PutUint16(rawPacket[2:], h.Length)

Expand Down
2 changes: 1 addition & 1 deletion receiver_estimated_maximum_bitrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func (p *ReceiverEstimatedMaximumBitrate) String() string {
powers++
}

unit := bitUnits[powers]
unit := bitUnits[powers] //nolint:gosec // powers is bounded by loop condition

return fmt.Sprintf("ReceiverEstimatedMaximumBitrate %x %.2f %s/s", p.SenderSSRC, bitrate, unit)
}
Expand Down
6 changes: 3 additions & 3 deletions reception_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ func (r ReceptionReport) Marshal() ([]byte, error) {
return nil, errInvalidTotalLost
}
tlBytes := rawPacket[totalLostOffset:]
tlBytes[0] = byte(r.TotalLost >> 16)
tlBytes[1] = byte(r.TotalLost >> 8)
tlBytes[2] = byte(r.TotalLost)
tlBytes[0] = byte(r.TotalLost >> 16) //nolint:gosec // rawPacket is created with length receptionReportLength (24)
tlBytes[1] = byte(r.TotalLost >> 8) //nolint:gosec // rawPacket is created with length receptionReportLength (24)
tlBytes[2] = byte(r.TotalLost) //nolint:gosec // rawPacket is created with length receptionReportLength (24)

binary.BigEndian.PutUint32(rawPacket[lastSeqOffset:], r.LastSequenceNumber)
binary.BigEndian.PutUint32(rawPacket[jitterOffset:], r.Jitter)
Expand Down
4 changes: 2 additions & 2 deletions source_description.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,14 @@ func (s SourceDescriptionItem) Marshal() ([]byte, error) {

rawPacket := make([]byte, sdesTypeLen+sdesOctetCountLen)

rawPacket[sdesTypeOffset] = uint8(s.Type)
rawPacket[sdesTypeOffset] = uint8(s.Type) //nolint:gosec // rawPacket is created with length 2

txtBytes := []byte(s.Text)
octetCount := len(txtBytes)
if octetCount > sdesMaxOctetCount {
return nil, errSDESTextTooLong
}
rawPacket[sdesOctetCountOffset] = uint8(octetCount)
rawPacket[sdesOctetCountOffset] = uint8(octetCount) //nolint:gosec // rawPacket is created with length 2

rawPacket = append(rawPacket, txtBytes...) //nolint:makezero

Expand Down
2 changes: 1 addition & 1 deletion transport_layer_cc.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func (r RecvDelta) Marshal() ([]byte, error) {
// small delta
if r.Type == TypeTCCPacketReceivedSmallDelta && delta >= 0 && delta <= math.MaxUint8 {
deltaChunk := make([]byte, 1)
deltaChunk[0] = byte(delta)
deltaChunk[0] = byte(delta) //nolint:gosec // deltaChunk is created with length 1

return deltaChunk, nil
}
Expand Down
Loading