Run gofmt.

This commit is contained in:
Juliusz Chroboczek
2025-03-21 15:15:41 +01:00
parent 400d821d1b
commit e09b135cd2
10 changed files with 38 additions and 38 deletions
+1 -1
View File
@@ -290,7 +290,7 @@ func PacketFlags(codec string, buf []byte) (Flags, error) {
flags.Start = vp9.B
flags.End = vp9.E
if vp9.B && len(vp9.Payload) > 0 &&
(vp9.Payload[0] & 0xc0) == 0x80 {
(vp9.Payload[0]&0xc0) == 0x80 {
profile := (vp9.Payload[0] >> 4) & 0x3
if profile != 3 {
flags.Keyframe = (vp9.Payload[0] & 0xC) == 0
+5 -5
View File
@@ -28,7 +28,7 @@ func TestAdjustOriginLocalNow(t *testing.T) {
c := &diskConn{
tracks: []*diskTrack{
&diskTrack{},
{},
},
}
for _, t := range c.tracks {
@@ -56,7 +56,7 @@ func TestAdjustOriginLocalEarlier(t *testing.T) {
c := &diskConn{
originLocal: earlier,
tracks: []*diskTrack{
&diskTrack{},
{},
},
}
for _, t := range c.tracks {
@@ -84,7 +84,7 @@ func TestAdjustOriginLocalLater(t *testing.T) {
c := &diskConn{
originLocal: later,
tracks: []*diskTrack{
&diskTrack{},
{},
},
}
for _, t := range c.tracks {
@@ -111,7 +111,7 @@ func TestAdjustOriginRemote(t *testing.T) {
c := &diskConn{
tracks: []*diskTrack{
&diskTrack{
{
remoteNTP: rtptime.TimeToNTP(earlier),
remoteRTP: 32,
},
@@ -144,7 +144,7 @@ func TestAdjustOriginLocalRemote(t *testing.T) {
c := &diskConn{
tracks: []*diskTrack{
&diskTrack{},
{},
},
}
for _, t := range c.tracks {
+5 -5
View File
@@ -1,10 +1,10 @@
package estimator
import (
"testing"
"time"
"sync"
"sync/atomic"
"testing"
"time"
"github.com/jech/galene/rtptime"
)
@@ -87,7 +87,7 @@ func TestEstimatorParallel(t *testing.T) {
addNow(rtptime.JiffiesPerSec / 1000)
b, p := estimate()
if i >= 1000 {
if b != p * 42 {
if b != p*42 {
t.Errorf("%v: Got %v %v (%v), expected %v %v",
n, p, b, i, 1000, p*42,
)
@@ -115,7 +115,7 @@ func BenchmarkEstimator(b *testing.B) {
e.Estimate()
b.ResetTimer()
for i := 0; i < 1000 * b.N; i++ {
for i := 0; i < 1000*b.N; i++ {
e.Accumulate(100)
}
@@ -130,7 +130,7 @@ func BenchmarkEstimatorParallel(b *testing.B) {
e.Estimate()
b.ResetTimer()
b.RunParallel(func (pb *testing.PB) {
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
for i := 0; i < 1000; i++ {
e.Accumulate(100)
+1 -1
View File
@@ -1021,7 +1021,7 @@ func (g *Group) userExists(username string) bool {
return found
}
//validUsername returns true if a string is a valid username.
// validUsername returns true if a string is a valid username.
// On the one hand, we want to allow usernames such as "jch@work"
// or "Alice c/o Bob". On the other hand, not restricting
// usernames might lead to security vulnaribilities.
+2 -2
View File
@@ -31,7 +31,7 @@ func (m *Map) Map(seqno uint16, pid uint16) (bool, uint16, uint16) {
if m.delta == 0 && m.entries == nil {
if compare(m.next, seqno) <= 0 ||
uint16(m.next - seqno) > 8 * 1024 {
uint16(m.next-seqno) > 8*1024 {
m.next = seqno + 1
m.nextPid = pid
}
@@ -192,7 +192,7 @@ func (m *Map) Drop(seqno uint16, pid uint16) bool {
if len(m.entries) == 0 {
m.entries = []entry{
entry{
{
first: seqno - 8192,
count: 8192,
delta: 0,
+10 -10
View File
@@ -165,14 +165,14 @@ func TestWraparound(t *testing.T) {
}
for i := 4; i < 256000; i++ {
ok, s, p = m.Map(uint16(i), uint16((i/2) & 0x7FFF))
ok, s, p = m.Map(uint16(i), uint16((i/2)&0x7FFF))
if !ok || s != uint16(i-2) || p != 1 {
t.Errorf("Expected %v, %v, got %v, %v, %v",
uint16(i-2), 1, ok, s, p)
}
}
ok, s, p = m.Map((256000 & 0xFFFF) + 2, 1)
ok, s, p = m.Map((256000&0xFFFF)+2, 1)
expect := uint16((256000) & 0xFFFF)
if !ok || s != expect || p != 1 {
t.Errorf("Expected %v, 1, got %v, %v, %v", expect, ok, s, p)
@@ -202,25 +202,25 @@ func TestWraparoundDrop(t *testing.T) {
t.Errorf("Expected 1, got %v, %v", ok, m.pidDelta)
}
for i := 4; i < 256000; i+= 3 {
ok, s, p = m.Map(uint16(i), uint16((i/2) & 0x7FFF))
for i := 4; i < 256000; i += 3 {
ok, s, p = m.Map(uint16(i), uint16((i/2)&0x7FFF))
if !ok || s != uint16((i-1)/3*2) || p != 1 {
t.Errorf("Expected %v, %v, got %v, %v, %v",
uint16((i-1)/3*2), 1, ok, s, p)
}
ok, s, p = m.Map(uint16(i + 1), uint16((i/2) & 0x7FFF))
if !ok || s != uint16((i-1)/3*2 + 1) || p != 1 {
ok, s, p = m.Map(uint16(i+1), uint16((i/2)&0x7FFF))
if !ok || s != uint16((i-1)/3*2+1) || p != 1 {
t.Errorf("Expected %v, %v, got %v, %v, %v",
uint16((i-1)/3*2 + 1), 1, ok, s, p)
uint16((i-1)/3*2+1), 1, ok, s, p)
}
ok = m.Drop(uint16(i + 2), uint16((i/2) & 0x7FFF))
ok = m.Drop(uint16(i+2), uint16((i/2)&0x7FFF))
if !ok {
t.Errorf("Expected ok")
}
}
ok, s, p = m.Map((256000 & 0xFFFF) + 4, 0)
expect := uint16(((256000 - 1)/3*2 + 4) & 0xFFFF)
ok, s, p = m.Map((256000&0xFFFF)+4, 0)
expect := uint16(((256000-1)/3*2 + 4) & 0xFFFF)
if !ok || s != expect || p != 1 {
t.Errorf("Expected %v, 1, got %v, %v, %v", expect, ok, s, p)
}
+2 -2
View File
@@ -234,8 +234,8 @@ func getCandidates(as []sdp.Attribute, mid *string, index *uint16, ufrag string)
continue
}
c := webrtc.ICECandidateInit{
Candidate: a.Value,
SDPMid: mid,
Candidate: a.Value,
SDPMid: mid,
SDPMLineIndex: index,
}
if ufrag != "" {
+2 -2
View File
@@ -1,8 +1,8 @@
package sdpfrag
import (
"testing"
"reflect"
"testing"
"github.com/pion/sdp/v3"
)
@@ -238,7 +238,7 @@ func testRoundtrip(t *testing.T, sdpfrag string) {
}
func TestRoundtrip(t *testing.T) {
type test struct { name, frag string }
type test struct{ name, frag string }
for _, tt := range []test{
{"sdpfragTrickle", sdpfragTrickle},
{"sdpfragEndOfCandidates", sdpfragEndOfCandidates},
+1 -1
View File
@@ -100,7 +100,7 @@ func ParseKeys(keys []map[string]any, alg, kid string) ([]jwt.VerificationKey, e
ks := make([]jwt.VerificationKey, 0, len(keys))
for _, ky := range keys {
// return all keys if alg and kid are not specified
if alg != "" && ky["alg"] != alg {
if alg != "" && ky["alg"] != alg {
continue
}
if kid != "" && ky["kid"] != kid {
+9 -9
View File
@@ -17,7 +17,7 @@ func timeEqual(a, b *time.Time) bool {
return true
}
if a!= nil && b != nil {
if a != nil && b != nil {
return (*a).Equal(*b)
}
@@ -228,14 +228,14 @@ func TestTokenStorage(t *testing.T) {
user2 := "user2"
user3 := "user3"
tokens := []*Stateful{
&Stateful{
{
Token: "tok1",
Group: "test",
Username: &user1,
Permissions: []string{"present", "message"},
Expires: &future,
},
&Stateful{
{
Token: "tok2",
Group: "test",
Username: &user2,
@@ -243,7 +243,7 @@ func TestTokenStorage(t *testing.T) {
Expires: &nearFuture,
NotBefore: &past,
},
&Stateful{
{
Token: "tok3",
Group: "test",
Username: &user3,
@@ -323,35 +323,35 @@ func TestExpire(t *testing.T) {
user := "user"
tokens := []*Stateful{
&Stateful{
{
Token: "tok1",
Group: "test",
Username: &user,
Permissions: []string{"present", "message"},
Expires: &now,
},
&Stateful{
{
Token: "tok2",
Group: "test",
Username: &user,
Permissions: []string{"present", "message"},
Expires: &future,
},
&Stateful{
{
Token: "tok3",
Group: "test",
Username: &user,
Permissions: []string{"present", "message"},
Expires: &now,
},
&Stateful{
{
Token: "tok4",
Group: "test",
Username: &user,
Permissions: []string{"present", "message"},
Expires: &past,
},
&Stateful{
{
Token: "tok5",
Group: "test",
Username: &user,