bump golangci-lint to 2.8.0 (#5350)
This commit is contained in:
@@ -23,7 +23,7 @@ jobs:
|
||||
|
||||
- uses: golangci/golangci-lint-action@v9
|
||||
with:
|
||||
version: v2.6.1
|
||||
version: v2.8.0
|
||||
|
||||
go_mod:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
@@ -208,7 +208,7 @@ func TestH264RTPOversized(t *testing.T) {
|
||||
}))
|
||||
require.NoError(t, err)
|
||||
|
||||
var out []*rtp.Packet
|
||||
var out []*rtp.Packet //nolint:prealloc
|
||||
|
||||
for _, pkt := range []*rtp.Packet{
|
||||
{
|
||||
|
||||
@@ -208,7 +208,7 @@ func TestH265RTPOversized(t *testing.T) {
|
||||
}))
|
||||
require.NoError(t, err)
|
||||
|
||||
var out []*rtp.Packet
|
||||
var out []*rtp.Packet //nolint:prealloc
|
||||
|
||||
for _, pkt := range []*rtp.Packet{
|
||||
{
|
||||
|
||||
@@ -584,9 +584,11 @@ func (pa *path) doAPIPathsGet(req pathAPIPathsGetReq) {
|
||||
return pa.stream.BytesSent()
|
||||
}(),
|
||||
Readers: func() []defs.APIPathSourceOrReader {
|
||||
ret := []defs.APIPathSourceOrReader{}
|
||||
ret := make([]defs.APIPathSourceOrReader, len(pa.readers))
|
||||
i := 0
|
||||
for r := range pa.readers {
|
||||
ret = append(ret, r.APIReaderDescribe())
|
||||
ret[i] = r.APIReaderDescribe()
|
||||
i++
|
||||
}
|
||||
return ret
|
||||
}(),
|
||||
|
||||
+21
-11
@@ -42,22 +42,32 @@ func FormatsInfo(formats []format.Format) string {
|
||||
strings.Join(FormatsToCodecs(formats), ", "))
|
||||
}
|
||||
|
||||
// MediasToCodecs returns the name of codecs of given formats.
|
||||
func MediasToCodecs(medias []*description.Media) []string {
|
||||
var formats []format.Format
|
||||
func gatherFormats(medias []*description.Media) []format.Format {
|
||||
n := 0
|
||||
for _, media := range medias {
|
||||
formats = append(formats, media.Formats...)
|
||||
n += len(media.Formats)
|
||||
}
|
||||
|
||||
return FormatsToCodecs(formats)
|
||||
if n == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
formats := make([]format.Format, n)
|
||||
n = 0
|
||||
|
||||
for _, media := range medias {
|
||||
n += copy(formats[n:], media.Formats)
|
||||
}
|
||||
|
||||
return formats
|
||||
}
|
||||
|
||||
// MediasToCodecs returns the name of codecs of given formats.
|
||||
func MediasToCodecs(medias []*description.Media) []string {
|
||||
return FormatsToCodecs(gatherFormats(medias))
|
||||
}
|
||||
|
||||
// MediasInfo returns a description of medias.
|
||||
func MediasInfo(medias []*description.Media) string {
|
||||
var formats []format.Format
|
||||
for _, media := range medias {
|
||||
formats = append(formats, media.Formats...)
|
||||
}
|
||||
|
||||
return FormatsInfo(formats)
|
||||
return FormatsInfo(gatherFormats(medias))
|
||||
}
|
||||
|
||||
@@ -613,11 +613,11 @@ func TestOnGet(t *testing.T) {
|
||||
|
||||
sampleData := make(map[int][][]byte)
|
||||
for _, track := range p.Tracks {
|
||||
var samples [][]byte
|
||||
for _, sample := range track.Samples {
|
||||
samples := make([][]byte, len(track.Samples))
|
||||
for i, sample := range track.Samples {
|
||||
buf, err = sample.GetPayload()
|
||||
require.NoError(t, err)
|
||||
samples = append(samples, buf)
|
||||
samples[i] = buf
|
||||
sample.GetPayload = nil
|
||||
}
|
||||
sampleData[track.ID] = samples
|
||||
|
||||
@@ -41,11 +41,24 @@ func (r *Reader) OnData(medi *description.Media, forma format.Format, cb OnDataF
|
||||
|
||||
// Formats returns all formats for which the reader has registered a OnData callback.
|
||||
func (r *Reader) Formats() []format.Format {
|
||||
var out []format.Format
|
||||
n := 0
|
||||
for _, formats := range r.onDatas {
|
||||
for range formats {
|
||||
n++
|
||||
}
|
||||
}
|
||||
|
||||
if n == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
out := make([]format.Format, n)
|
||||
n = 0
|
||||
|
||||
for _, formats := range r.onDatas {
|
||||
for forma := range formats {
|
||||
out = append(out, forma)
|
||||
out[n] = forma
|
||||
n++
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user