mirror of
https://github.com/pion/webrtc.git
synced 2026-04-22 15:07:23 +08:00
Apply modernize and lint upgrades
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
@@ -512,7 +511,7 @@ func (d *DataChannel) DetachWithDeadline() (datachannel.ReadWriteCloserDeadliner
|
||||
d.sctpTransport.lock.Lock()
|
||||
n := len(d.sctpTransport.dataChannels)
|
||||
j := 0
|
||||
for i := 0; i < n; i++ {
|
||||
for i := range n {
|
||||
if d == d.sctpTransport.dataChannels[i] {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
@@ -208,7 +207,7 @@ func TestDataChannelBufferedAmount(t *testing.T) { //nolint:cyclop
|
||||
answerDC.OnOpen(func() {
|
||||
assert.Equal(t, answerBufferedAmountLowThreshold, answerDC.BufferedAmountLowThreshold(), "value mismatch")
|
||||
|
||||
for i := 0; i < nPacketsToSend; i++ {
|
||||
for range nPacketsToSend {
|
||||
e := answerDC.Send(buf)
|
||||
assert.NoError(t, e, "Failed to send string on data channel")
|
||||
}
|
||||
@@ -239,7 +238,7 @@ func TestDataChannelBufferedAmount(t *testing.T) { //nolint:cyclop
|
||||
offerDC.OnOpen(func() {
|
||||
assert.Equal(t, offerBufferedAmountLowThreshold, offerDC.BufferedAmountLowThreshold(), "value mismatch")
|
||||
|
||||
for i := 0; i < nPacketsToSend; i++ {
|
||||
for range nPacketsToSend {
|
||||
e := offerDC.Send(buf)
|
||||
assert.NoError(t, e, "Failed to send string on data channel")
|
||||
// assert.Equal(t, (i+1)*len(buf), int(offerDC.BufferedAmount()), "unexpected bufferedAmount")
|
||||
@@ -318,7 +317,7 @@ func TestDataChannelBufferedAmount(t *testing.T) { //nolint:cyclop
|
||||
atomic.AddUint32(&nCbs, 1)
|
||||
})
|
||||
|
||||
for i := 0; i < 10; i++ {
|
||||
for range 10 {
|
||||
assert.NoError(t, dc.Send(buf), "Failed to send string on data channel")
|
||||
assert.Equal(t, uint64(1500), dc.BufferedAmountLowThreshold(), "value mismatch")
|
||||
// assert.Equal(t, (i+1)*len(buf), int(dc.BufferedAmount()), "unexpected bufferedAmount")
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ func benchmarkDataChannelSend(b *testing.B, numChannels int) {
|
||||
})
|
||||
|
||||
var wg sync.WaitGroup
|
||||
for i := 0; i < numChannels; i++ {
|
||||
for i := range numChannels {
|
||||
label := fmt.Sprintf("dc-%d", i)
|
||||
open[label] = make(chan bool)
|
||||
wg.Add(1)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// bandwidth-estimation-from-disk demonstrates how to use Pion's Bandwidth Estimation APIs.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// broadcast demonstrates how to broadcast a video to many peers, while only requiring the broadcaster to upload once.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// custom-logger is an example of how the Pion API provides an customizable logging API
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// simple-datachannel is a simple datachannel demo that auto connects.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// whip-whep demonstrates how to use the WHIP/WHEP specifications to exchange SPD descriptions
|
||||
// and stream media to a WebRTC client in the browser or OBS.
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package main
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// ice-proxy demonstrates Pion WebRTC's proxy abilities.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package main
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package main
|
||||
|
||||
@@ -109,7 +108,7 @@ func proxyHandleConn(clientConn net.Conn) {
|
||||
}
|
||||
|
||||
// Establish a connection to the target server
|
||||
targetConn, err := net.Dial("tcp", req.URL.Host) // nolint: noctx
|
||||
targetConn, err := net.Dial("tcp", req.URL.Host) // nolint:noctx,gosec
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package main
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// ice-single-port demonstrates Pion WebRTC's ability to serve many PeerConnections on a single port.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// ice-tcp demonstrates Pion WebRTC's ICE TCP abilities.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// insertable-streams demonstrates how to use insertable streams with Pion
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// ortc demonstrates Pion WebRTC's ORTC capabilities.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// ortc demonstrates Pion WebRTC's ORTC capabilities.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// play-from-disk-fec demonstrates how to use forward error correction (FlexFEC-03)
|
||||
// while sending video to your Chrome-based browser from files saved to disk.
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// ogg-playlist-sctp streams Opus pages from single or multi-track Ogg containers,
|
||||
// exposes the playlist over a DataChannel, and lets the browser switch tracks.
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// play-from-disk-renegotiation demonstrates Pion WebRTC's renegotiation abilities.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// play-from-disk demonstrates how to send video and/or audio to your browser from files saved to disk.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// quick-switch demonstrates Pion WebRTC's ability to quickly switch between videos.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// reflect demonstrates how with one PeerConnection you can send video to Pion and have the packets sent back
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// repacketize demonstrates how many video codecs can be received, depacketized
|
||||
// and packetized by Pion over RTP.
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// rtcp-processing demonstrates the Public API for processing RTCP packets in Pion WebRTC.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// rtp-forwarder shows how to forward your webcam/microphone via RTP using Pion WebRTC.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// rtp-to-webrtc demonstrates how to consume a RTP stream video UDP, and then send to a WebRTC client.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// save-to-disk-av1 is a simple application that shows how to save a video to disk using AV1.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// save-to-disk is a simple application that shows how to record your webcam/microphone using
|
||||
// Pion WebRTC and save VP8/Opus to disk.
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// simulcast demonstrates of how to handle incoming track with multiple simulcast rtp streams and show all them back.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// stats demonstrates how to use the webrtc-stats implementation provided by Pion WebRTC.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// swap-tracks demonstrates how to swap multiple incoming tracks on a single outgoing track.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// show-network-usage shows the amount of packets flowing through the vnet
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// WARP (SNAP+SPED) testbed.
|
||||
package main
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
// whip-whep demonstrates how to use the WHIP/WHEP specifications to exchange SPD descriptions
|
||||
// and stream media to a WebRTC client in the browser or OBS.
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
+5
-4
@@ -5,6 +5,7 @@ package webrtc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/pion/ice/v4"
|
||||
)
|
||||
@@ -151,17 +152,17 @@ func (c ICECandidate) ToICE() (cand ice.Candidate, err error) {
|
||||
}
|
||||
|
||||
func (c *ICECandidate) setExtensions(ext []ice.CandidateExtension) {
|
||||
var extensions string
|
||||
var extensions strings.Builder
|
||||
|
||||
for i := range ext {
|
||||
if i > 0 {
|
||||
extensions += " "
|
||||
extensions.WriteString(" ")
|
||||
}
|
||||
|
||||
extensions += ext[i].Key + " " + ext[i].Value
|
||||
extensions.WriteString(ext[i].Key + " " + ext[i].Value)
|
||||
}
|
||||
|
||||
c.extensions = extensions
|
||||
c.extensions = extensions.String()
|
||||
}
|
||||
|
||||
func (c *ICECandidate) exportExtensions(cand ice.Candidate) error {
|
||||
|
||||
@@ -345,7 +345,6 @@ func TestICECandidateExtensions_ToJSON(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, cand := range candidates {
|
||||
cand := cand
|
||||
candidate, err := ice.UnmarshalCandidate(cand.candidate)
|
||||
assert.NoError(t, err)
|
||||
|
||||
|
||||
@@ -114,5 +114,6 @@ func (t *ICECandidateType) UnmarshalText(b []byte) error {
|
||||
}
|
||||
|
||||
func (r ICECandidateType) toICE() ice.CandidateType {
|
||||
//nolint:gosec // G115, no overflow, ICECandidateType matches ice.CandidateType in granularity.
|
||||
return ice.CandidateType(r)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
@@ -1316,7 +1315,7 @@ func TestICEGatherer_StaticLocalCredentialsVNet(t *testing.T) { //nolint:cyclop
|
||||
|
||||
parseCreds := func(sdp string) (string, string) {
|
||||
var ufrag, pwd string
|
||||
for _, l := range strings.Split(sdp, "\n") {
|
||||
for l := range strings.SplitSeq(sdp, "\n") {
|
||||
l = strings.TrimSpace(l)
|
||||
if after, ok := strings.CutPrefix(l, "a=ice-ufrag:"); ok {
|
||||
ufrag = after
|
||||
|
||||
+1
-1
@@ -7,6 +7,6 @@ package webrtc
|
||||
// and password and other ICE-related parameters.
|
||||
type ICEParameters struct {
|
||||
UsernameFragment string `json:"usernameFragment"`
|
||||
Password string `json:"password"`
|
||||
Password string `json:"password"` //nolint:gosec // not a secret.
|
||||
ICELite bool `json:"iceLite"`
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
@@ -36,7 +35,7 @@ func TestICEServer_validate(t *testing.T) {
|
||||
{ICEServer{
|
||||
URLs: []string{"turn:192.158.29.39?transport=udp"},
|
||||
Username: "unittest",
|
||||
Credential: OAuthCredential{
|
||||
Credential: OAuthCredential{ //nolint:gosec // not hardcoded credentials.
|
||||
MACKey: "WmtzanB3ZW9peFhtdm42NzUzNG0=",
|
||||
AccessToken: "AAwg3kPHWPfvk9bDFL936wYvkoctMADzQ5VhNDgeMR3+ZlZ35byg972fW8QjpEl7bx91YLBPFsIhsxloWcXPhA==",
|
||||
},
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
+3
-4
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
@@ -533,7 +532,7 @@ func testInterceptorNack(t *testing.T, requestNack bool) { //nolint:cyclop
|
||||
|
||||
done := make(chan struct{})
|
||||
pc2.OnTrack(func(track2 *TrackRemote, _ *RTPReceiver) {
|
||||
for i := 0; i < numPackets; i++ {
|
||||
for i := range numPackets {
|
||||
if i == 1 {
|
||||
continue
|
||||
}
|
||||
@@ -545,7 +544,7 @@ func testInterceptorNack(t *testing.T, requestNack bool) { //nolint:cyclop
|
||||
})
|
||||
|
||||
go func() {
|
||||
for i := 0; i < numPackets; i++ {
|
||||
for i := range numPackets {
|
||||
time.Sleep(20 * time.Millisecond)
|
||||
if i == 1 {
|
||||
continue
|
||||
@@ -861,7 +860,7 @@ func TestNackNotSentForRTX(t *testing.T) { //nolint:cyclop
|
||||
})
|
||||
|
||||
go func() {
|
||||
for i := 0; i < numPackets; i++ {
|
||||
for i := range numPackets {
|
||||
time.Sleep(20 * time.Millisecond)
|
||||
var p rtp.Packet
|
||||
p.Version = 2
|
||||
|
||||
@@ -37,7 +37,7 @@ func defaultChannels(mimeType string) uint16 {
|
||||
func parseParameters(line string) map[string]string {
|
||||
parameters := make(map[string]string)
|
||||
|
||||
for _, p := range strings.Split(line, ";") {
|
||||
for p := range strings.SplitSeq(line, ";") {
|
||||
pp := strings.SplitN(strings.TrimSpace(p), "=", 2)
|
||||
key := strings.ToLower(pp[0])
|
||||
var value string
|
||||
|
||||
@@ -36,7 +36,7 @@ func TestMultiError(t *testing.T) {
|
||||
|
||||
errIs, ok := errs.(multiError) //nolint:errorlint
|
||||
assert.True(t, ok, "FlattenErrs returns non-multiError")
|
||||
for i := 0; i < 3; i++ {
|
||||
for i := range 3 {
|
||||
assert.Truef(t, errIs.Is(rawErrs[i]), "Should contains this error '%v'", rawErrs[i])
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
+1
-1
@@ -14,5 +14,5 @@ type OAuthCredential struct {
|
||||
|
||||
// AccessToken is a base64-encoded format. This is an encrypted
|
||||
// self-contained token that is opaque to the application.
|
||||
AccessToken string
|
||||
AccessToken string //nolint:gosec // not a secret.
|
||||
}
|
||||
|
||||
+3
-3
@@ -22,7 +22,7 @@ func TestOperations_Enqueue(t *testing.T) {
|
||||
})
|
||||
defer ops.GracefulClose()
|
||||
|
||||
for resultSet := 0; resultSet < 100; resultSet++ {
|
||||
for resultSet := range 100 {
|
||||
results := make([]int, 16)
|
||||
resultSetCopy := resultSet
|
||||
for i := range results {
|
||||
@@ -65,7 +65,7 @@ func TestOperations_GracefulClose(t *testing.T) {
|
||||
counterMu.Unlock()
|
||||
}
|
||||
const times = 25
|
||||
for i := 0; i < times; i++ {
|
||||
for range times {
|
||||
ops.Enqueue(incFunc)
|
||||
}
|
||||
ops.Done()
|
||||
@@ -75,7 +75,7 @@ func TestOperations_GracefulClose(t *testing.T) {
|
||||
assert.Equal(t, counterCur, times)
|
||||
|
||||
ops.GracefulClose()
|
||||
for i := 0; i < times; i++ {
|
||||
for range times {
|
||||
ops.Enqueue(incFunc)
|
||||
}
|
||||
ops.Done()
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
@@ -218,7 +217,7 @@ func TestPeerConnection_GracefulCloseWithIncomingMessages(t *testing.T) {
|
||||
})
|
||||
|
||||
// send 50 messages, then close pcOffer, and then send another 50
|
||||
for i := 0; i < 100; i++ {
|
||||
for i := range 100 {
|
||||
if i == 50 {
|
||||
assert.NoError(t, pcOffer.GracefulClose())
|
||||
}
|
||||
@@ -272,7 +271,7 @@ func TestPeerConnection_GracefulCloseConcurrent(t *testing.T) {
|
||||
const gracefulCloseConcurrency = 50
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(gracefulCloseConcurrency)
|
||||
for i := 0; i < gracefulCloseConcurrency; i++ {
|
||||
for range gracefulCloseConcurrency {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
assert.NoError(t, pc.GracefulClose())
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
@@ -74,7 +73,7 @@ func TestNew_Go(t *testing.T) {
|
||||
"turns:google.de?transport=tcp",
|
||||
},
|
||||
Username: "unittest",
|
||||
Credential: OAuthCredential{
|
||||
Credential: OAuthCredential{ //nolint:gosec // not hardcoded credentials.
|
||||
MACKey: "WmtzanB3ZW9peFhtdm42NzUzNG0=",
|
||||
AccessToken: "AAwg3kPHWPfvk9bDFL936wYvkoctMADzQ==",
|
||||
},
|
||||
@@ -219,7 +218,7 @@ func TestPeerConnection_SetConfiguration_Go(t *testing.T) {
|
||||
"turns:google.de?transport=tcp",
|
||||
},
|
||||
Username: "unittest",
|
||||
Credential: OAuthCredential{
|
||||
Credential: OAuthCredential{ //nolint:gosec // not hardcoded credentials.
|
||||
MACKey: "WmtzanB3ZW9peFhtdm42NzUzNG0=",
|
||||
AccessToken: "AAwg3kPHWPfvk9bDFL936wYvkoctMADzQ==",
|
||||
},
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
@@ -1218,7 +1217,7 @@ func TestPlanBMediaExchange(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
|
||||
outboundTracks := []*TrackLocalStaticSample{}
|
||||
for i := 0; i < trackCount; i++ {
|
||||
for range trackCount {
|
||||
outboundTracks = append(outboundTracks, addSingleTrack(pcOffer))
|
||||
}
|
||||
|
||||
@@ -1709,7 +1708,7 @@ func TestPeerConnection_RaceReplaceTrack(t *testing.T) {
|
||||
return track
|
||||
}
|
||||
|
||||
for i := 0; i < 10; i++ {
|
||||
for range 10 {
|
||||
addTrack()
|
||||
}
|
||||
for _, tr := range pc.GetTransceivers() {
|
||||
@@ -1719,7 +1718,7 @@ func TestPeerConnection_RaceReplaceTrack(t *testing.T) {
|
||||
var wg sync.WaitGroup
|
||||
tracks := make([]*TrackLocalStaticSample, 10)
|
||||
wg.Add(10)
|
||||
for i := 0; i < 10; i++ {
|
||||
for i := range 10 {
|
||||
go func(j int) {
|
||||
tracks[j] = addTrack()
|
||||
wg.Done()
|
||||
@@ -2115,7 +2114,7 @@ func TestPeerConnection_Simulcast_RTX(t *testing.T) { //nolint:cyclop
|
||||
|
||||
assertRidCorrect(t)
|
||||
|
||||
for i := 0; i < simulcastProbeCount+10; i++ {
|
||||
for range simulcastProbeCount + 10 {
|
||||
sequenceNumber++
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
@@ -2284,7 +2283,7 @@ sendRIDs:
|
||||
|
||||
assertNoRepairStreams()
|
||||
|
||||
for i := 0; i < 50; i++ {
|
||||
for i := range 50 {
|
||||
sequenceNumber++
|
||||
pkt := &rtp.Packet{
|
||||
Header: rtp.Header{
|
||||
@@ -2300,7 +2299,7 @@ sendRIDs:
|
||||
require.NoError(t, vp8WriterA.WriteRTP(pkt))
|
||||
}
|
||||
|
||||
for i := 0; i < 50; i++ {
|
||||
for i := range 50 {
|
||||
sequenceNumber++
|
||||
pkt := &rtp.Packet{
|
||||
Header: rtp.Header{
|
||||
@@ -2317,7 +2316,7 @@ sendRIDs:
|
||||
require.NoError(t, vp8WriterA.WriteRTP(pkt))
|
||||
}
|
||||
|
||||
for i := 0; i < 10; i++ {
|
||||
for range 10 {
|
||||
assertNoRepairStreams()
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
@@ -2423,7 +2422,7 @@ func TestPeerConnection_Simulcast_NoDataChannel(t *testing.T) {
|
||||
connectionWg.Wait()
|
||||
|
||||
var seqNo uint16
|
||||
for i := 0; i < 100; i++ {
|
||||
for range 100 {
|
||||
pkt := &rtp.Packet{
|
||||
Header: rtp.Header{
|
||||
Version: 2,
|
||||
@@ -2545,8 +2544,7 @@ func Test_PeerConnection_RTX_E2E(t *testing.T) { //nolint:cyclop
|
||||
})
|
||||
|
||||
// Create context for coordinated cleanup
|
||||
testCtx, testCancel := context.WithCancel(context.Background())
|
||||
defer testCancel()
|
||||
testCtx := t.Context()
|
||||
|
||||
// RTCP reader with proper cleanup
|
||||
go func() {
|
||||
@@ -2695,7 +2693,7 @@ func TestPeerConnection_Simulcast_Probe_PacketLoss(t *testing.T) { //nolint:cycl
|
||||
pcAnswer.OnTrack(func(trackRemote *TrackRemote, _ *RTPReceiver) {
|
||||
actualBuffer := []byte{}
|
||||
|
||||
for i := 0; i < rtpPktCount; i++ {
|
||||
for range rtpPktCount {
|
||||
pkt, _, err := trackRemote.ReadRTP()
|
||||
assert.NoError(t, err)
|
||||
|
||||
@@ -2729,7 +2727,7 @@ func TestPeerConnection_Simulcast_Probe_PacketLoss(t *testing.T) { //nolint:cycl
|
||||
peerConnectionConnected := untilConnectionState(PeerConnectionStateConnected, pcOffer, pcAnswer)
|
||||
peerConnectionConnected.Wait()
|
||||
|
||||
for sequenceNumber := uint16(0); sequenceNumber < rtpPktCount; sequenceNumber++ {
|
||||
for sequenceNumber := range uint16(rtpPktCount) {
|
||||
pkt := &rtp.Packet{
|
||||
Header: rtp.Header{
|
||||
Version: 2,
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
@@ -92,7 +91,6 @@ func TestPeerConnection_Renegotiation_AddRecvonlyTransceiver(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
lim := test.TimeOut(time.Second * 30)
|
||||
defer lim.Stop()
|
||||
@@ -987,7 +985,7 @@ func TestNegotiationNeededStressOneSided(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
for i := 0; i < expectedTrackCount; i++ {
|
||||
for range expectedTrackCount {
|
||||
track, err := NewTrackLocalStaticSample(RTPCodecCapability{MimeType: MimeTypeVP8}, "video", "pion")
|
||||
assert.NoError(t, err)
|
||||
|
||||
@@ -1233,7 +1231,7 @@ func TestPeerConnection_Regegotiation_ReuseTransceiver(t *testing.T) {
|
||||
})
|
||||
|
||||
ssrcReuse := sender.GetParameters().Encodings[0].SSRC
|
||||
for i := 0; i < 10; i++ {
|
||||
for range 10 {
|
||||
assert.NoError(t, vp8Track.WriteRTP(&rtp.Packet{Header: rtp.Header{Version: 2}, Payload: []byte{0, 1, 2, 3, 4, 5}}))
|
||||
time.Sleep(20 * time.Millisecond)
|
||||
}
|
||||
@@ -1255,7 +1253,7 @@ func TestPeerConnection_Regegotiation_ReuseTransceiver(t *testing.T) {
|
||||
assert.NoError(t, signalPair(pcOffer, pcAnswer))
|
||||
assert.True(t, sender3.rtpTransceiver == pcOffer.GetTransceivers()[2])
|
||||
|
||||
for i := 0; i < 10; i++ {
|
||||
for range 10 {
|
||||
assert.NoError(t, vp8Track.WriteRTP(&rtp.Packet{Header: rtp.Header{Version: 2}, Payload: []byte{0, 1, 2, 3, 4, 5}}))
|
||||
time.Sleep(20 * time.Millisecond)
|
||||
}
|
||||
|
||||
@@ -919,7 +919,7 @@ func TestPeerConnection_SessionID(t *testing.T) {
|
||||
var offerSessionVersion uint64
|
||||
var answerSessionID uint64
|
||||
var answerSessionVersion uint64
|
||||
for i := 0; i < 10; i++ {
|
||||
for i := range 10 {
|
||||
assert.NoError(t, signalPair(pcOffer, pcAnswer))
|
||||
var offer sdp.SessionDescription
|
||||
assert.NoError(t, offer.UnmarshalString(pcOffer.LocalDescription().SDP))
|
||||
|
||||
@@ -52,7 +52,6 @@ func TestIsKeyFrame(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := isKeyFrame(tt.payload)
|
||||
assert.Equal(t, tt.want, got)
|
||||
@@ -123,7 +122,6 @@ func TestWriteRTP(t *testing.T) {
|
||||
var reuseH264Writer *H264Writer
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
writer := &bytes.Buffer{}
|
||||
h264Writer := &H264Writer{
|
||||
|
||||
@@ -536,7 +536,7 @@ func TestIVFWriter_DirectPTS_Precision(t *testing.T) {
|
||||
offset := 32 // Start after IVF header.
|
||||
|
||||
var lastPTS uint64
|
||||
for idx := 0; idx < 225; idx++ {
|
||||
for range 225 {
|
||||
frameSize := uint32(data[offset]) | uint32(data[offset+1])<<8 |
|
||||
uint32(data[offset+2])<<16 | uint32(data[offset+3])<<24
|
||||
lastPTS = uint64(data[offset+4]) | uint64(data[offset+5])<<8 |
|
||||
|
||||
@@ -353,14 +353,14 @@ func generateChecksumTable() *[256]uint32 {
|
||||
|
||||
for i := range table {
|
||||
r := uint32(i) << 24 //nolint:gosec // G115
|
||||
for j := 0; j < 8; j++ {
|
||||
for range 8 {
|
||||
if (r & 0x80000000) != 0 {
|
||||
r = (r << 1) ^ poly
|
||||
} else {
|
||||
r <<= 1
|
||||
}
|
||||
table[i] = (r & 0xffffffff)
|
||||
}
|
||||
table[i] = (r & 0xffffffff) //nolint:gosec // no out of bounds access here.
|
||||
}
|
||||
|
||||
return &table
|
||||
|
||||
@@ -52,7 +52,7 @@ func buildUnknownMappingFamilyContainer(mappingFamily, channels uint8) []byte {
|
||||
mappingFamily,
|
||||
}
|
||||
|
||||
segmentTable := []byte{byte(len(payload))}
|
||||
segmentTable := []byte{byte(len(payload))} //nolint:gosec // G115: test-only, sized by construction.
|
||||
|
||||
header := []byte{
|
||||
0x4f, 0x67, 0x67, 0x53, // "OggS"
|
||||
@@ -92,7 +92,7 @@ func buildChannelMappingFamilyContainer(
|
||||
}
|
||||
payload = append(payload, mapping...)
|
||||
|
||||
segmentTable := []byte{byte(len(payload))}
|
||||
segmentTable := []byte{byte(len(payload))} //nolint:gosec // G115: test-only, sized by construction.
|
||||
|
||||
header := []byte{
|
||||
0x4f, 0x67, 0x67, 0x53, // "OggS"
|
||||
@@ -222,7 +222,6 @@ func TestOggReader_ChannelMappingFamily1(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
reader, err := NewWithOptions(
|
||||
bytes.NewReader(buildChannelMappingFamilyContainer(1, tc.channels, tc.streams, tc.coupled, tc.channelMap)),
|
||||
@@ -268,7 +267,6 @@ func TestOggReader_KnownChannelMappingFamilies(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
container := buildChannelMappingFamilyContainer(
|
||||
tc.mappingFamily, tc.channels, tc.streams, tc.coupled, tc.channelMap,
|
||||
@@ -320,7 +318,6 @@ func TestOggReader_ParseExtraFieldsForNonZeroMappingFamily(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
container := buildChannelMappingFamilyContainer(
|
||||
tc.mappingFamily, tc.channels, tc.streams, tc.coupled, tc.channelMap,
|
||||
@@ -577,7 +574,7 @@ func buildOggPage(serial uint32, pageIndex uint32, headerType uint8, payload []b
|
||||
binary.LittleEndian.PutUint32(indexBytes, pageIndex)
|
||||
|
||||
// Build segment table (single segment containing entire payload)
|
||||
segmentTable := []byte{byte(len(payload))}
|
||||
segmentTable := []byte{byte(len(payload))} //nolint:gosec // G115: test-only, sized by construction.
|
||||
|
||||
// Build page header (27 bytes)
|
||||
header := []byte{
|
||||
@@ -848,7 +845,6 @@ func TestParseOpusTagsErrors(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
tags, err := ParseOpusTags(tc.payload)
|
||||
assert.Nil(t, tags)
|
||||
|
||||
@@ -272,14 +272,14 @@ func generateChecksumTable() *[256]uint32 {
|
||||
|
||||
for i := range table {
|
||||
remainder := uint32(i) << 24 //nolint:gosec // G115
|
||||
for j := 0; j < 8; j++ {
|
||||
for range 8 {
|
||||
if (remainder & 0x80000000) != 0 {
|
||||
remainder = (remainder << 1) ^ poly
|
||||
} else {
|
||||
remainder <<= 1
|
||||
}
|
||||
table[i] = (remainder & 0xffffffff)
|
||||
}
|
||||
table[i] = (remainder & 0xffffffff) //nolint:gosec // no out of bounds access here.
|
||||
}
|
||||
|
||||
return &table
|
||||
|
||||
@@ -409,7 +409,6 @@ func TestSampleBuilderCleanReference(t *testing.T) {
|
||||
0xFFF8, // check upper boundary
|
||||
0xFFFE, // check upper boundary
|
||||
} {
|
||||
seqStart := seqStart
|
||||
t.Run(fmt.Sprintf("From%d", seqStart), func(t *testing.T) {
|
||||
fd := New(10, &fakeDepacketizer{}, 1)
|
||||
|
||||
@@ -421,7 +420,7 @@ func TestSampleBuilderCleanReference(t *testing.T) {
|
||||
pkt5 := &rtp.Packet{Header: rtp.Header{SequenceNumber: 12 + seqStart, Timestamp: 120}, Payload: []byte{0x05}}
|
||||
fd.Push(pkt5)
|
||||
|
||||
for i := 0; i < 3; i++ {
|
||||
for i := range 3 {
|
||||
assert.Nilf(
|
||||
t, fd.buffer[(i+int(seqStart))%0x10000],
|
||||
"Old packet (%d) is not unreferenced (maxLate: 10, pushed: 12)", i,
|
||||
@@ -521,7 +520,7 @@ func TestSampleBuilderData(t *testing.T) {
|
||||
alwaysHead: true,
|
||||
}, 1)
|
||||
validSamples := 0
|
||||
for i := 0; i < 0x20000; i++ {
|
||||
for i := range 0x20000 {
|
||||
packet := rtp.Packet{
|
||||
Header: rtp.Header{
|
||||
SequenceNumber: uint16(i), //nolint:gosec // G115
|
||||
@@ -555,7 +554,7 @@ func TestSampleBuilderPacketUnreference(t *testing.T) {
|
||||
atomic.AddInt64(&refs, -1)
|
||||
}
|
||||
|
||||
for i := 0; i < 0x20000; i++ {
|
||||
for i := range 0x20000 {
|
||||
atomic.AddInt64(&refs, 1)
|
||||
packet := rtp.Packet{
|
||||
Header: rtp.Header{
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
+4
-5
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
@@ -124,7 +123,7 @@ func TestRTPReceiver_ClosedReceiveForRIDAndRTX(t *testing.T) {
|
||||
},
|
||||
)
|
||||
|
||||
for i := 0; i < 50; i++ {
|
||||
for range 50 {
|
||||
track, err := receiver.receiveForRid("rid", params, ridStreamInfo, nil, nil, nil, nil, nil)
|
||||
assert.Nil(t, track)
|
||||
assert.ErrorIs(t, err, io.EOF)
|
||||
@@ -199,7 +198,7 @@ func TestRTPReceiver_readRTX_ChannelAccessSafe(t *testing.T) {
|
||||
},
|
||||
)
|
||||
|
||||
for i := 0; i < 50; i++ {
|
||||
for range 50 {
|
||||
require.NoError(t, receiver.receiveForRtx(SSRC(2222), "", repairStreamInfo, nil, rtpInterceptor, nil, nil))
|
||||
}
|
||||
|
||||
@@ -274,7 +273,7 @@ func TestRTPReceiver_ReadRTP_SimulcastNoRace(t *testing.T) {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for i := 0; i < 5; i++ {
|
||||
for range 5 {
|
||||
_, _, err = lowTrack.Read(make([]byte, 1500))
|
||||
require.NoError(t, err)
|
||||
}
|
||||
@@ -305,7 +304,7 @@ func TestRTPReceiver_ReadRTP_SimulcastNoRace(t *testing.T) {
|
||||
receiver.tracks[1].track.params = params
|
||||
receiver.tracks[1].track.mu.Unlock()
|
||||
|
||||
for i := 0; i < 5; i++ {
|
||||
for range 5 {
|
||||
lowCh <- lowPkt
|
||||
}
|
||||
close(lowCh)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
@@ -191,7 +190,7 @@ func TestSCTPTransportOutOfBandNegotiatedDataChannelDetach(t *testing.T) { //nol
|
||||
// nolint:varnamelen
|
||||
const N = 10
|
||||
done := make(chan struct{}, N)
|
||||
for i := 0; i < N; i++ {
|
||||
for range N {
|
||||
go func() {
|
||||
// Use Detach data channels mode
|
||||
s := SettingEngine{}
|
||||
@@ -285,7 +284,7 @@ func TestSCTPTransportOutOfBandNegotiatedDataChannelDetach(t *testing.T) { //nol
|
||||
}()
|
||||
}
|
||||
|
||||
for i := 0; i < N; i++ {
|
||||
for range N {
|
||||
select {
|
||||
case <-done:
|
||||
case <-time.After(20 * time.Second):
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
@@ -298,8 +297,8 @@ func getRids(media *sdp.MediaDescription) []*simulcastRid {
|
||||
if space := strings.Index(simulcastAttr, " "); space > 0 {
|
||||
simulcastAttr = simulcastAttr[space+1:]
|
||||
}
|
||||
ridStates := strings.Split(simulcastAttr, ";")
|
||||
for _, ridState := range ridStates {
|
||||
ridStates := strings.SplitSeq(simulcastAttr, ";")
|
||||
for ridState := range ridStates {
|
||||
if ridState[:1] == "~" {
|
||||
ridID := ridState[1:]
|
||||
for _, rid := range rids {
|
||||
@@ -994,7 +993,7 @@ func extractICEDetailsFromMedia( //nolint:cyclop
|
||||
|
||||
type sdpICEDetails struct {
|
||||
Ufrag string
|
||||
Password string
|
||||
Password string //nolint:gosec // not a secret.
|
||||
Candidates []ICECandidate
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
@@ -732,7 +731,7 @@ func TestMediaDescriptionFingerprints(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
for i := range 2 {
|
||||
media[i].transceivers[0].setSender(&RTPSender{})
|
||||
media[i].transceivers[0].setDirection(RTPTransceiverDirectionSendonly)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -135,7 +135,6 @@ func TestHasICETrickleOption(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
desc := SessionDescription{Type: SDPTypeOffer, SDP: tc.sdp}
|
||||
_, err := desc.Unmarshal()
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
@@ -58,7 +57,7 @@ type SettingEngine struct {
|
||||
MulticastDNSMode ice.MulticastDNSMode
|
||||
MulticastDNSHostName string
|
||||
UsernameFragment string
|
||||
Password string
|
||||
Password string //nolint:gosec // not a secret.
|
||||
IncludeLoopbackCandidate bool
|
||||
}
|
||||
replayProtection struct {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
@@ -562,7 +561,7 @@ func TestEnableDataChannelBlockWrite(t *testing.T) {
|
||||
rawDC := <-detachChan
|
||||
assert.NoError(t, rawDC.SetWriteDeadline(time.Now().Add(time.Second)))
|
||||
buf := make([]byte, 1000)
|
||||
for i := 0; i < 10; i++ {
|
||||
for range 10 {
|
||||
_, err = rawDC.Write(buf)
|
||||
if err != nil {
|
||||
break
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package webrtc
|
||||
|
||||
@@ -351,7 +350,7 @@ func Test_TrackLocalStatic_Padding(t *testing.T) {
|
||||
assert.Equal(t, track.PayloadType(), PayloadType(100))
|
||||
assert.Equal(t, track.Codec().RTPCodecCapability.MimeType, "video/VP8")
|
||||
|
||||
for i := 0; i < 20; i++ {
|
||||
for range 20 {
|
||||
// Padding payload
|
||||
p, _, e := track.ReadRTP()
|
||||
assert.NoError(t, e)
|
||||
@@ -922,7 +921,7 @@ func TestTrackLocalStaticSample_WriteSample_NoTimestampDrift(t *testing.T) {
|
||||
track.sequencer = rtp.NewRandomSequencer()
|
||||
track.rtpTrack.mu.Unlock()
|
||||
|
||||
for i := 0; i < numFrames; i++ {
|
||||
for range numFrames {
|
||||
err := track.WriteSample(media.Sample{
|
||||
Data: []byte{0x00},
|
||||
Duration: frameDuration,
|
||||
@@ -971,7 +970,7 @@ func TestTrackLocalStaticSample_WriteSample_DroppedPackets_NoDrift(t *testing.T)
|
||||
var expectedTotal uint64
|
||||
var remainder float64
|
||||
|
||||
for i := 0; i < numFrames; i++ {
|
||||
for i := range numFrames {
|
||||
var drops uint16
|
||||
if (i+1)%300 == 0 {
|
||||
drops = uint16((i/300)%3 + 1) //nolint:gosec
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user