error logging
This commit is contained in:
@@ -157,7 +157,7 @@ func (t *DataTrack) forwardWorker() {
|
||||
err := sub.SendMessage(msg)
|
||||
if err != nil {
|
||||
logger.Errorw("could not send data message",
|
||||
"err", err,
|
||||
err,
|
||||
"source", t.participantId,
|
||||
"dest", sub.participantId)
|
||||
}
|
||||
|
||||
@@ -12,11 +12,12 @@ import (
|
||||
"github.com/pion/webrtc/v3"
|
||||
"github.com/pion/webrtc/v3/pkg/rtcerr"
|
||||
|
||||
"github.com/livekit/protocol/utils"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/config"
|
||||
"github.com/livekit/livekit-server/pkg/logger"
|
||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||
livekit "github.com/livekit/livekit-server/proto"
|
||||
"github.com/livekit/protocol/utils"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -199,9 +200,8 @@ func (t *MediaTrack) AddSubscriber(sub types.Participant) error {
|
||||
return
|
||||
}
|
||||
if _, ok := err.(*rtcerr.InvalidStateError); !ok {
|
||||
logger.Warnw("could not remove remoteTrack from forwarder",
|
||||
"sub", sub.Identity(),
|
||||
"err", err)
|
||||
logger.Warnw("could not remove remoteTrack from forwarder", err,
|
||||
"sub", sub.Identity())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ func (t *MediaTrack) AddReceiver(receiver *webrtc.RTPReceiver, track *webrtc.Tra
|
||||
rtcpReader.OnPacket(func(bytes []byte) {
|
||||
pkts, err := rtcp.Unmarshal(bytes)
|
||||
if err != nil {
|
||||
logger.Errorw("could not unmarshal RTCP", "error", err)
|
||||
logger.Errorw("could not unmarshal RTCP", err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
+13
-15
@@ -14,13 +14,14 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"github.com/livekit/protocol/utils"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/config"
|
||||
"github.com/livekit/livekit-server/pkg/logger"
|
||||
"github.com/livekit/livekit-server/pkg/routing"
|
||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||
livekit "github.com/livekit/livekit-server/proto"
|
||||
"github.com/livekit/livekit-server/version"
|
||||
"github.com/livekit/protocol/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -524,7 +525,7 @@ func (p *ParticipantImpl) SetTrackMuted(trackId string, muted bool) {
|
||||
defer p.lock.RUnlock()
|
||||
track := p.publishedTracks[trackId]
|
||||
if track == nil {
|
||||
logger.Warnw("could not locate track", "track", trackId)
|
||||
logger.Warnw("could not locate track", nil, "track", trackId)
|
||||
return
|
||||
}
|
||||
currentMuted := track.IsMuted()
|
||||
@@ -646,8 +647,7 @@ func (p *ParticipantImpl) writeMessage(msg *livekit.SignalResponse) error {
|
||||
sink := p.params.Sink
|
||||
err := sink.WriteMessage(msg)
|
||||
if err != nil {
|
||||
logger.Warnw("could not send message to participant",
|
||||
"error", err,
|
||||
logger.Warnw("could not send message to participant", err,
|
||||
"id", p.ID(),
|
||||
"participant", p.Identity(),
|
||||
"message", fmt.Sprintf("%T", msg.Message))
|
||||
@@ -684,7 +684,7 @@ func (p *ParticipantImpl) onMediaTrack(track *webrtc.TrackRemote, rtpReceiver *w
|
||||
"rid", track.RID())
|
||||
|
||||
if !p.CanPublish() {
|
||||
logger.Warnw("no permission to publish mediaTrack",
|
||||
logger.Warnw("no permission to publish mediaTrack", nil,
|
||||
"participant", p.Identity())
|
||||
return
|
||||
}
|
||||
@@ -749,7 +749,7 @@ func (p *ParticipantImpl) onDataChannel(dc *webrtc.DataChannel) {
|
||||
logger.Debugw("dataChannel added", "participant", p.Identity(), "label", dc.Label())
|
||||
|
||||
if !p.CanPublish() {
|
||||
logger.Warnw("no permission to publish dataTrack",
|
||||
logger.Warnw("no permission to publish dataTrack", nil,
|
||||
"participant", p.Identity())
|
||||
return
|
||||
}
|
||||
@@ -786,7 +786,7 @@ func (p *ParticipantImpl) getPendingTrack(clientId string, kind livekit.TrackTyp
|
||||
|
||||
// if still not found, we are done
|
||||
if ti == nil {
|
||||
logger.Errorw("track info not published prior to track", "clientId", clientId)
|
||||
logger.Errorw("track info not published prior to track", nil, "clientId", clientId)
|
||||
} else if deleteAfter {
|
||||
delete(p.pendingTracks, clientId)
|
||||
}
|
||||
@@ -796,7 +796,7 @@ func (p *ParticipantImpl) getPendingTrack(clientId string, kind livekit.TrackTyp
|
||||
func (p *ParticipantImpl) handleDataMessage(kind livekit.DataPacket_Kind, data []byte) {
|
||||
dp := livekit.DataPacket{}
|
||||
if err := proto.Unmarshal(data, &dp); err != nil {
|
||||
logger.Warnw("could not parse data packet", "error", err)
|
||||
logger.Warnw("could not parse data packet", err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -811,7 +811,7 @@ func (p *ParticipantImpl) handleDataMessage(kind livekit.DataPacket_Kind, data [
|
||||
p.onDataPacket(p, &dp)
|
||||
}
|
||||
default:
|
||||
logger.Warnw("received unsupported data packet", "payload", payload)
|
||||
logger.Warnw("received unsupported data packet", nil, "payload", payload)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -894,9 +894,8 @@ func (p *ParticipantImpl) downTracksRTCPWorker() {
|
||||
if err == io.EOF || err == io.ErrClosedPipe {
|
||||
return
|
||||
}
|
||||
logger.Errorw("could not send downtrack reports",
|
||||
"participant", p.Identity(),
|
||||
"err", err)
|
||||
logger.Errorw("could not send downtrack reports", err,
|
||||
"participant", p.Identity())
|
||||
}
|
||||
pkts = pkts[:0]
|
||||
}
|
||||
@@ -914,9 +913,8 @@ func (p *ParticipantImpl) rtcpSendWorker() {
|
||||
// logger.Debugw("writing RTCP", "packet", pkt)
|
||||
//}
|
||||
if err := p.publisher.pc.WriteRTCP(pkts); err != nil {
|
||||
logger.Errorw("could not write RTCP to participant",
|
||||
"participant", p.Identity(),
|
||||
"err", err)
|
||||
logger.Errorw("could not write RTCP to participant", err,
|
||||
"participant", p.Identity())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -6,10 +6,11 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/livekit/protocol/utils"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/logger"
|
||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||
livekit "github.com/livekit/livekit-server/proto"
|
||||
"github.com/livekit/protocol/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -360,7 +361,7 @@ func (r *Room) onTrackAdded(participant types.Participant, track types.Published
|
||||
"remoteTrack", track.ID(),
|
||||
"dest", existingParticipant.Identity())
|
||||
if err := track.AddSubscriber(existingParticipant); err != nil {
|
||||
logger.Errorw("could not subscribe to remoteTrack",
|
||||
logger.Errorw("could not subscribe to remoteTrack", err,
|
||||
"source", participant.Identity(),
|
||||
"remoteTrack", track.ID(),
|
||||
"dest", existingParticipant.Identity())
|
||||
@@ -415,7 +416,7 @@ func (r *Room) subscribeToExistingTracks(p types.Participant) {
|
||||
}
|
||||
if n, err := op.AddSubscriber(p); err != nil {
|
||||
// TODO: log error? or disconnect?
|
||||
logger.Errorw("could not subscribe to participant",
|
||||
logger.Errorw("could not subscribe to participant", err,
|
||||
"dest", p.Identity(),
|
||||
"source", op.Identity())
|
||||
} else {
|
||||
@@ -439,9 +440,8 @@ func (r *Room) broadcastParticipantState(p types.Participant, skipSource bool) {
|
||||
|
||||
err := op.SendParticipantUpdate(updates)
|
||||
if err != nil {
|
||||
logger.Errorw("could not send update to participant",
|
||||
"participant", p.Identity(),
|
||||
"err", err)
|
||||
logger.Errorw("could not send update to participant", err,
|
||||
"participant", p.Identity())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,11 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/bep/debounce"
|
||||
"github.com/livekit/livekit-server/pkg/logger"
|
||||
"github.com/pion/interceptor"
|
||||
"github.com/pion/webrtc/v3"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/logger"
|
||||
|
||||
livekit "github.com/livekit/livekit-server/proto"
|
||||
)
|
||||
|
||||
@@ -95,7 +96,7 @@ func NewPCTransport(params TransportParams) (*PCTransport, error) {
|
||||
if state == webrtc.ICEGathererStateComplete {
|
||||
if restart, ok := t.restartAfterGathering.Load().(bool); ok && restart {
|
||||
if err := t.CreateAndSendOffer(&webrtc.OfferOptions{ICERestart: true}); err != nil {
|
||||
logger.Warnw("could not restart ICE", "error", err)
|
||||
logger.Warnw("could not restart ICE", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,7 +157,7 @@ func (t *PCTransport) OnOffer(f func(sd webrtc.SessionDescription)) {
|
||||
func (t *PCTransport) Negotiate() {
|
||||
t.debouncedNegotiate(func() {
|
||||
if err := t.CreateAndSendOffer(nil); err != nil {
|
||||
logger.Errorw("could not negotiate", "error", err)
|
||||
logger.Errorw("could not negotiate", err)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -200,13 +201,13 @@ func (t *PCTransport) CreateAndSendOffer(options *webrtc.OfferOptions) error {
|
||||
|
||||
offer, err := t.pc.CreateOffer(options)
|
||||
if err != nil {
|
||||
logger.Errorw("could not create offer", "err", err)
|
||||
logger.Errorw("could not create offer", err)
|
||||
return err
|
||||
}
|
||||
|
||||
err = t.pc.SetLocalDescription(offer)
|
||||
if err != nil {
|
||||
logger.Errorw("could not set local description", "err", err)
|
||||
logger.Errorw("could not set local description", err)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user