diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go index 6a2ed28e8..39be203f3 100644 --- a/pkg/logger/logger.go +++ b/pkg/logger/logger.go @@ -3,12 +3,12 @@ package serverlogger import ( "github.com/go-logr/logr" "github.com/go-logr/zapr" + "github.com/livekit/protocol/logger" "github.com/pion/logging" "go.uber.org/zap" "go.uber.org/zap/zapcore" "github.com/livekit/livekit-server/pkg/config" - "github.com/livekit/protocol/logger" ) var ( diff --git a/pkg/routing/selector/regionaware.go b/pkg/routing/selector/regionaware.go index 3ab3c6ca3..5e6cade08 100644 --- a/pkg/routing/selector/regionaware.go +++ b/pkg/routing/selector/regionaware.go @@ -83,12 +83,12 @@ func (s *RegionAwareSelector) SelectNode(nodes []*livekit.Node) (*livekit.Node, return nodes[idx], nil } -// haversin(θ) function +// haversine(θ) function func hsin(theta float64) float64 { return math.Pow(math.Sin(theta/2), 2) } -// Haversin Distance Formula +// Haversine Distance Formula // http://en.wikipedia.org/wiki/Haversine_formula // from https://gist.github.com/cdipaolo/d3f8db3848278b49db68 func distanceBetween(lat1, lon1, lat2, lon2 float64) float64 { diff --git a/pkg/rtc/mediatracksubscriptions.go b/pkg/rtc/mediatracksubscriptions.go index 87a43b0a5..5329f8c6b 100644 --- a/pkg/rtc/mediatracksubscriptions.go +++ b/pkg/rtc/mediatracksubscriptions.go @@ -184,7 +184,7 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, code downTrack.SetTransceiver(transceiver) - // when outtrack is bound, start loop to send reports + // when out track is bound, start loop to send reports downTrack.OnBind(func() { go subTrack.Bound() go t.sendDownTrackBindingReports(sub) diff --git a/pkg/rtc/participant.go b/pkg/rtc/participant.go index 467a736dd..c701127f6 100644 --- a/pkg/rtc/participant.go +++ b/pkg/rtc/participant.go @@ -8,11 +8,8 @@ import ( "sync/atomic" "time" - "github.com/livekit/livekit-server/pkg/sfu/connectionquality" - "github.com/livekit/livekit-server/pkg/sfu/twcc" - "github.com/livekit/protocol/auth" - lru "github.com/hashicorp/golang-lru" + "github.com/livekit/protocol/auth" "github.com/livekit/protocol/livekit" "github.com/livekit/protocol/logger" "github.com/livekit/protocol/utils" @@ -25,6 +22,8 @@ import ( "github.com/livekit/livekit-server/pkg/routing" "github.com/livekit/livekit-server/pkg/rtc/types" "github.com/livekit/livekit-server/pkg/sfu" + "github.com/livekit/livekit-server/pkg/sfu/connectionquality" + "github.com/livekit/livekit-server/pkg/sfu/twcc" "github.com/livekit/livekit-server/pkg/telemetry" "github.com/livekit/livekit-server/pkg/telemetry/prometheus" "github.com/livekit/livekit-server/version" diff --git a/pkg/rtc/transport.go b/pkg/rtc/transport.go index b2f457683..a2db9675d 100644 --- a/pkg/rtc/transport.go +++ b/pkg/rtc/transport.go @@ -93,9 +93,9 @@ func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimat // Disable SRTP replay protection (https://datatracker.ietf.org/doc/html/rfc3711#page-15). // Needed due to lack of RTX stream support in Pion. // - // When clients probe for bandwidth, there are sveral possible approaches + // When clients probe for bandwidth, there are several possible approaches // 1. Use padding packet (Chrome uses this) - // 2. Use an older packet (Forefox uses this) + // 2. Use an older packet (Firefox uses this) // Typically, these are sent over the RTX stream and hence SRTP replay protection will not // trigger. As Pion does not support RTX, when firefox uses older packet for probing, they // trigger the replay protection. @@ -113,7 +113,7 @@ func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimat } // // This introduces a half-RTT extra latency in connection setup, - // i. e. if SFU is acting as DTLSRoleClient, it can send the client-hello as soon + // i.e. if SFU is acting as DTLSRoleClient, it can send the client-hello as soon // as it is ready. With this change, signalling has to be sent back to the client // and client has to do client-hello which adds half RTT. // diff --git a/pkg/sfu/buffer/buffer.go b/pkg/sfu/buffer/buffer.go index 976585d96..3e5ce3bff 100644 --- a/pkg/sfu/buffer/buffer.go +++ b/pkg/sfu/buffer/buffer.go @@ -151,13 +151,13 @@ func (b *Buffer) Bind(params webrtc.RTPParameters, codec webrtc.RTPCodecCapabili for _, fb := range codec.RTCPFeedback { switch fb.Type { case webrtc.TypeRTCPFBGoogREMB: - b.logger.Infow("Setting feedback", "type", webrtc.TypeRTCPFBGoogREMB) + b.logger.Debugw("Setting feedback", "type", webrtc.TypeRTCPFBGoogREMB) b.remb = true case webrtc.TypeRTCPFBTransportCC: - b.logger.Infow("Setting feedback", "type", webrtc.TypeRTCPFBTransportCC) + b.logger.Debugw("Setting feedback", "type", webrtc.TypeRTCPFBTransportCC) b.twcc = true case webrtc.TypeRTCPFBNACK: - b.logger.Infow("Setting feedback", "type", webrtc.TypeRTCPFBNACK) + b.logger.Debugw("Setting feedback", "type", webrtc.TypeRTCPFBNACK) b.nacker = NewNACKQueue() b.nack = true } @@ -177,7 +177,7 @@ func (b *Buffer) Bind(params webrtc.RTPParameters, codec webrtc.RTPCodecCapabili b.pPackets = nil b.bound = true - b.logger.Infow("NewBuffer", "MaxBitRate", o.MaxBitRate) + b.logger.Debugw("NewBuffer", "MaxBitRate", o.MaxBitRate) } // Write adds an RTP Packet, out of order, new packet may be arrived later diff --git a/pkg/sfu/buffer/helpers.go b/pkg/sfu/buffer/helpers.go index 1a5761c93..d31830c6d 100644 --- a/pkg/sfu/buffer/helpers.go +++ b/pkg/sfu/buffer/helpers.go @@ -269,7 +269,7 @@ func IsH264Keyframe(payload []byte) bool { return true } else if n >= 24 { // is this legal? - logger.Infow("Non-simple NALU within a STAP") + logger.Debugw("Non-simple NALU within a STAP") } i += int(length) } diff --git a/pkg/sfu/downtrack.go b/pkg/sfu/downtrack.go index f5e25651e..17eeb5a76 100644 --- a/pkg/sfu/downtrack.go +++ b/pkg/sfu/downtrack.go @@ -493,7 +493,7 @@ func (d *DownTrack) CloseWithFlush(flush bool) { } d.closeOnce.Do(func() { - d.logger.Infow("closing sender", "peerID", d.peerID, "trackID", d.id, "kind", d.kind) + d.logger.Debugw("closing sender", "peerID", d.peerID, "trackID", d.id, "kind", d.kind) d.receiver.DeleteDownTrack(d.peerID) d.connectionStats.Close() diff --git a/pkg/sfu/forwarder.go b/pkg/sfu/forwarder.go index 544e0d98e..9a423341d 100644 --- a/pkg/sfu/forwarder.go +++ b/pkg/sfu/forwarder.go @@ -6,10 +6,10 @@ import ( "strings" "sync" + "github.com/livekit/protocol/logger" "github.com/pion/webrtc/v3" "github.com/livekit/livekit-server/pkg/sfu/buffer" - "github.com/livekit/protocol/logger" ) // diff --git a/pkg/sfu/forwarder_test.go b/pkg/sfu/forwarder_test.go index 71b015fc4..2ec522bf3 100644 --- a/pkg/sfu/forwarder_test.go +++ b/pkg/sfu/forwarder_test.go @@ -4,12 +4,12 @@ import ( "reflect" "testing" + "github.com/livekit/protocol/logger" "github.com/pion/webrtc/v3" "github.com/stretchr/testify/require" "github.com/livekit/livekit-server/pkg/sfu/buffer" "github.com/livekit/livekit-server/pkg/sfu/testutils" - "github.com/livekit/protocol/logger" ) func disable(f *Forwarder) { diff --git a/pkg/sfu/receiver.go b/pkg/sfu/receiver.go index 7832beae0..d15d2a3da 100644 --- a/pkg/sfu/receiver.go +++ b/pkg/sfu/receiver.go @@ -348,9 +348,9 @@ func (w *WebRTCReceiver) GetTotalBytes() uint64 { defer w.bufferMu.RUnlock() totalBytes := uint64(0) - for _, buffer := range w.buffers { - if buffer != nil { - stats := buffer.GetStats() + for _, buff := range w.buffers { + if buff != nil { + stats := buff.GetStats() totalBytes += stats.TotalBytes } } diff --git a/pkg/sfu/rtpmunger.go b/pkg/sfu/rtpmunger.go index 32e280569..095ebfd00 100644 --- a/pkg/sfu/rtpmunger.go +++ b/pkg/sfu/rtpmunger.go @@ -1,8 +1,9 @@ package sfu import ( - "github.com/livekit/livekit-server/pkg/sfu/buffer" "github.com/livekit/protocol/logger" + + "github.com/livekit/livekit-server/pkg/sfu/buffer" ) // diff --git a/pkg/sfu/rtpmunger_test.go b/pkg/sfu/rtpmunger_test.go index 97756437f..1e4d175dc 100644 --- a/pkg/sfu/rtpmunger_test.go +++ b/pkg/sfu/rtpmunger_test.go @@ -4,10 +4,10 @@ import ( "reflect" "testing" + "github.com/livekit/protocol/logger" "github.com/stretchr/testify/require" "github.com/livekit/livekit-server/pkg/sfu/testutils" - "github.com/livekit/protocol/logger" ) func newRTPMunger() *RTPMunger { diff --git a/pkg/sfu/sequencer.go b/pkg/sfu/sequencer.go index 6399102ab..3ea025b97 100644 --- a/pkg/sfu/sequencer.go +++ b/pkg/sfu/sequencer.go @@ -4,8 +4,9 @@ import ( "sync" "time" - "github.com/livekit/livekit-server/pkg/sfu/buffer" "github.com/livekit/protocol/logger" + + "github.com/livekit/livekit-server/pkg/sfu/buffer" ) const ( @@ -127,7 +128,7 @@ func (n *sequencer) push(sn, offSn uint16, timeStamp uint32, layer uint8, head b step = n.step - int(n.headSN-offSn) if step < 0 { if step*-1 >= n.max { - n.logger.Infow("old packet received, can not be sequenced", "head", sn, "received", offSn) + n.logger.Debugw("old packet received, can not be sequenced", "head", sn, "received", offSn) return nil } step = n.max + step diff --git a/pkg/sfu/sequencer_test.go b/pkg/sfu/sequencer_test.go index 537c247ac..1f1831641 100644 --- a/pkg/sfu/sequencer_test.go +++ b/pkg/sfu/sequencer_test.go @@ -5,10 +5,10 @@ import ( "testing" "time" + "github.com/livekit/protocol/logger" "github.com/stretchr/testify/require" "github.com/livekit/livekit-server/pkg/sfu/buffer" - "github.com/livekit/protocol/logger" ) func Test_sequencer(t *testing.T) { diff --git a/pkg/sfu/streamallocator.go b/pkg/sfu/streamallocator.go index a29c41c3a..3e123c5dd 100644 --- a/pkg/sfu/streamallocator.go +++ b/pkg/sfu/streamallocator.go @@ -630,7 +630,7 @@ func (s *StreamAllocator) handleSignalSendProbe(event *Event) { func (s *StreamAllocator) setState(state State) { if s.state != state { - s.params.Logger.Infow("state change", "from", s.state, "to", state) + s.params.Logger.Debugw("state change", "from", s.state, "to", state) } s.state = state diff --git a/pkg/sfu/vp8munger.go b/pkg/sfu/vp8munger.go index 565676d98..7250eb355 100644 --- a/pkg/sfu/vp8munger.go +++ b/pkg/sfu/vp8munger.go @@ -2,9 +2,9 @@ package sfu import ( "github.com/elliotchance/orderedmap" + "github.com/livekit/protocol/logger" "github.com/livekit/livekit-server/pkg/sfu/buffer" - "github.com/livekit/protocol/logger" ) // diff --git a/pkg/sfu/vp8munger_test.go b/pkg/sfu/vp8munger_test.go index 7dff2e30f..1f356ff4f 100644 --- a/pkg/sfu/vp8munger_test.go +++ b/pkg/sfu/vp8munger_test.go @@ -4,11 +4,11 @@ import ( "reflect" "testing" + "github.com/livekit/protocol/logger" "github.com/stretchr/testify/require" "github.com/livekit/livekit-server/pkg/sfu/buffer" "github.com/livekit/livekit-server/pkg/sfu/testutils" - "github.com/livekit/protocol/logger" ) func compare(expected *VP8Munger, actual *VP8Munger) bool { diff --git a/pkg/telemetry/telemetryserviceinternal.go b/pkg/telemetry/telemetryserviceinternal.go index db50f9588..a1e439950 100644 --- a/pkg/telemetry/telemetryserviceinternal.go +++ b/pkg/telemetry/telemetryserviceinternal.go @@ -4,9 +4,10 @@ import ( "context" "github.com/gammazero/workerpool" - "github.com/livekit/livekit-server/pkg/telemetry/prometheus" "github.com/livekit/protocol/livekit" "github.com/livekit/protocol/webhook" + + "github.com/livekit/livekit-server/pkg/telemetry/prometheus" ) type TelemetryServiceInternal interface { diff --git a/test/client/client.go b/test/client/client.go index cf37ce185..aabcb3a67 100644 --- a/test/client/client.go +++ b/test/client/client.go @@ -204,7 +204,7 @@ func NewRTCClient(conn *websocket.Conn) (*RTCClient, error) { c.publisher.OnOffer(c.onOffer) c.subscriber.PeerConnection().OnICEConnectionStateChange(func(connectionState webrtc.ICEConnectionState) { - logger.Infow("subscriber ICE state has changed", "state", connectionState.String(), + logger.Debugw("subscriber ICE state has changed", "state", connectionState.String(), "participant", c.localParticipant.Identity) if connectionState == webrtc.ICEConnectionStateConnected { // flush peers @@ -571,7 +571,7 @@ func (c *RTCClient) GetPublishedTrackIDs() []string { c.lock.Lock() defer c.lock.Unlock() var trackIDs []string - for key, _ := range c.localTracks { + for key := range c.localTracks { trackIDs = append(trackIDs, key) } return trackIDs diff --git a/test/client/trackwriter.go b/test/client/trackwriter.go index c4939d212..564ecae8d 100644 --- a/test/client/trackwriter.go +++ b/test/client/trackwriter.go @@ -53,7 +53,7 @@ func (w *TrackWriter) Start() error { return err } - logger.Infow("starting track writer", + logger.Debugw("starting track writer", "track", w.track.ID(), "mime", w.mime) switch w.mime { @@ -110,7 +110,7 @@ func (w *TrackWriter) writeOgg() { } pageData, pageHeader, err := w.ogg.ParseNextPage() if err == io.EOF { - logger.Infow("all audio samples parsed and sent") + logger.Debugw("all audio samples parsed and sent") w.onWriteComplete() return } @@ -144,7 +144,7 @@ func (w *TrackWriter) writeVP8() { } frame, _, err := w.ivf.ParseNextFrame() if err == io.EOF { - logger.Infow("all video frames parsed and sent") + logger.Debugw("all video frames parsed and sent") w.onWriteComplete() return } diff --git a/test/multinode_roomservice_test.go b/test/multinode_roomservice_test.go index f08bf133b..85b9139b6 100644 --- a/test/multinode_roomservice_test.go +++ b/test/multinode_roomservice_test.go @@ -4,9 +4,10 @@ import ( "fmt" "testing" - "github.com/livekit/livekit-server/pkg/testutils" "github.com/livekit/protocol/livekit" "github.com/stretchr/testify/require" + + "github.com/livekit/livekit-server/pkg/testutils" ) func TestMultiNodeRoomList(t *testing.T) { diff --git a/test/scenarios.go b/test/scenarios.go index 3bdc58c88..ec9807663 100644 --- a/test/scenarios.go +++ b/test/scenarios.go @@ -5,12 +5,13 @@ import ( "testing" "time" - "github.com/livekit/livekit-server/pkg/testutils" - testclient "github.com/livekit/livekit-server/test/client" "github.com/livekit/protocol/livekit" "github.com/livekit/protocol/logger" "github.com/livekit/protocol/utils" "github.com/stretchr/testify/require" + + "github.com/livekit/livekit-server/pkg/testutils" + testclient "github.com/livekit/livekit-server/test/client" ) // a scenario with lots of clients connecting, publishing, and leaving at random periods diff --git a/test/singlenode_test.go b/test/singlenode_test.go index 4c531c8e1..72673886b 100644 --- a/test/singlenode_test.go +++ b/test/singlenode_test.go @@ -8,7 +8,6 @@ import ( "testing" "time" - "github.com/livekit/livekit-server/pkg/config" "github.com/livekit/protocol/auth" "github.com/livekit/protocol/livekit" "github.com/livekit/protocol/logger" @@ -16,6 +15,7 @@ import ( "github.com/stretchr/testify/require" "github.com/thoas/go-funk" + "github.com/livekit/livekit-server/pkg/config" "github.com/livekit/livekit-server/pkg/rtc" "github.com/livekit/livekit-server/pkg/testutils" testclient "github.com/livekit/livekit-server/test/client"