mirror of
https://github.com/livekit/livekit.git
synced 2026-03-31 00:15:38 +00:00
clean up logs and imports (#400)
This commit is contained in:
@@ -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 (
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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.
|
||||
//
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
//
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
//
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
//
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user