A few more logging component changes (#1934)

This commit is contained in:
David Zhao
2023-08-03 18:46:48 -07:00
committed by GitHub
parent debd75fa15
commit 0f9fb24678
2 changed files with 17 additions and 17 deletions
+11 -11
View File
@@ -556,7 +556,7 @@ func (p *ParticipantImpl) HandleSignalSourceClose() {
// HandleOffer an offer from remote participant, used when clients make the initial connection // HandleOffer an offer from remote participant, used when clients make the initial connection
func (p *ParticipantImpl) HandleOffer(offer webrtc.SessionDescription) { func (p *ParticipantImpl) HandleOffer(offer webrtc.SessionDescription) {
p.params.Logger.Debugw("received offer", "transport", livekit.SignalTarget_PUBLISHER) p.pubLogger.Debugw("received offer", "transport", livekit.SignalTarget_PUBLISHER)
shouldPend := false shouldPend := false
if p.MigrateState() == types.MigrateStateInit { if p.MigrateState() == types.MigrateStateInit {
shouldPend = true shouldPend = true
@@ -570,7 +570,7 @@ func (p *ParticipantImpl) HandleOffer(offer webrtc.SessionDescription) {
// HandleAnswer handles a client answer response, with subscriber PC, server initiates the // HandleAnswer handles a client answer response, with subscriber PC, server initiates the
// offer and client answers // offer and client answers
func (p *ParticipantImpl) HandleAnswer(answer webrtc.SessionDescription) { func (p *ParticipantImpl) HandleAnswer(answer webrtc.SessionDescription) {
p.params.Logger.Debugw("received answer", "transport", livekit.SignalTarget_SUBSCRIBER) p.subLogger.Debugw("received answer", "transport", livekit.SignalTarget_SUBSCRIBER)
/* from server received join request to client answer /* from server received join request to client answer
* 1. server send join response & offer * 1. server send join response & offer
@@ -588,7 +588,7 @@ func (p *ParticipantImpl) onPublisherAnswer(answer webrtc.SessionDescription) er
return nil return nil
} }
p.params.Logger.Debugw("sending answer", "transport", livekit.SignalTarget_PUBLISHER) p.pubLogger.Debugw("sending answer", "transport", livekit.SignalTarget_PUBLISHER)
answer = p.configurePublisherAnswer(answer) answer = p.configurePublisherAnswer(answer)
if err := p.writeMessage(&livekit.SignalResponse{ if err := p.writeMessage(&livekit.SignalResponse{
Message: &livekit.SignalResponse_Answer{ Message: &livekit.SignalResponse_Answer{
@@ -614,7 +614,7 @@ func (p *ParticipantImpl) handleMigrateMutedTrack() {
} }
if len(pti.trackInfos) > 1 { if len(pti.trackInfos) > 1 {
p.params.Logger.Warnw("too many pending migrated tracks", nil, "trackID", pti.trackInfos[0].Sid, "count", len(pti.trackInfos), "cid", cid) p.pubLogger.Warnw("too many pending migrated tracks", nil, "trackID", pti.trackInfos[0].Sid, "count", len(pti.trackInfos), "cid", cid)
} }
ti := pti.trackInfos[0] ti := pti.trackInfos[0]
@@ -623,7 +623,7 @@ func (p *ParticipantImpl) handleMigrateMutedTrack() {
if mt != nil { if mt != nil {
addedTracks = append(addedTracks, mt) addedTracks = append(addedTracks, mt)
} else { } else {
p.params.Logger.Warnw("could not find migrated muted track", nil, "cid", cid) p.pubLogger.Warnw("could not find migrated muted track", nil, "cid", cid)
} }
} }
} }
@@ -659,7 +659,7 @@ func (p *ParticipantImpl) removeMutedTrackNotFired(mt *MediaTrack) {
// records track details and lets client know it's ok to proceed // records track details and lets client know it's ok to proceed
func (p *ParticipantImpl) AddTrack(req *livekit.AddTrackRequest) { func (p *ParticipantImpl) AddTrack(req *livekit.AddTrackRequest) {
if !p.CanPublishSource(req.Source) { if !p.CanPublishSource(req.Source) {
p.params.Logger.Warnw("no permission to publish track", nil) p.pubLogger.Warnw("no permission to publish track", nil)
return return
} }
@@ -686,7 +686,7 @@ func (p *ParticipantImpl) SetMigrateInfo(
p.supervisor.SetPublicationMute(livekit.TrackID(ti.Sid), ti.Muted) p.supervisor.SetPublicationMute(livekit.TrackID(ti.Sid), ti.Muted)
p.pendingTracks[t.GetCid()] = &pendingTrackInfo{trackInfos: []*livekit.TrackInfo{ti}, migrated: true} p.pendingTracks[t.GetCid()] = &pendingTrackInfo{trackInfos: []*livekit.TrackInfo{ti}, migrated: true}
p.params.Logger.Infow("pending track added (migration)", "trackID", ti.Sid, "track", ti.String()) p.pubLogger.Infow("pending track added (migration)", "trackID", ti.Sid, "track", ti.String())
} }
p.pendingTracksLock.Unlock() p.pendingTracksLock.Unlock()
@@ -813,7 +813,7 @@ func (p *ParticipantImpl) MaybeStartMigration(force bool, onStart func()) bool {
return return
} }
// TODO: change to debug once we are confident // TODO: change to debug once we are confident
p.params.Logger.Infow("closing subscriber peer connection to aid migration") p.subLogger.Infow("closing subscriber peer connection to aid migration")
// //
// Close all down tracks before closing subscriber peer connection. // Close all down tracks before closing subscriber peer connection.
@@ -1060,7 +1060,7 @@ func (p *ParticipantImpl) onTrackUnsubscribed(subTrack types.SubscribedTrack) {
} }
func (p *ParticipantImpl) SubscriptionPermissionUpdate(publisherID livekit.ParticipantID, trackID livekit.TrackID, allowed bool) { func (p *ParticipantImpl) SubscriptionPermissionUpdate(publisherID livekit.ParticipantID, trackID livekit.TrackID, allowed bool) {
p.params.Logger.Debugw("sending subscription permission update", "publisherID", publisherID, "trackID", trackID, "allowed", allowed) p.subLogger.Debugw("sending subscription permission update", "publisherID", publisherID, "trackID", trackID, "allowed", allowed)
err := p.writeMessage(&livekit.SignalResponse{ err := p.writeMessage(&livekit.SignalResponse{
Message: &livekit.SignalResponse_SubscriptionPermissionUpdate{ Message: &livekit.SignalResponse_SubscriptionPermissionUpdate{
SubscriptionPermissionUpdate: &livekit.SubscriptionPermissionUpdate{ SubscriptionPermissionUpdate: &livekit.SubscriptionPermissionUpdate{
@@ -1071,7 +1071,7 @@ func (p *ParticipantImpl) SubscriptionPermissionUpdate(publisherID livekit.Parti
}, },
}) })
if err != nil { if err != nil {
p.params.Logger.Errorw("could not send subscription permission update", err) p.subLogger.Errorw("could not send subscription permission update", err)
} }
} }
@@ -1250,7 +1250,7 @@ func (p *ParticipantImpl) setIsPublisher(isPublisher bool) {
// when the server has an offer for participant // when the server has an offer for participant
func (p *ParticipantImpl) onSubscriberOffer(offer webrtc.SessionDescription) error { func (p *ParticipantImpl) onSubscriberOffer(offer webrtc.SessionDescription) error {
p.params.Logger.Debugw("sending offer", "transport", livekit.SignalTarget_SUBSCRIBER) p.subLogger.Debugw("sending offer", "transport", livekit.SignalTarget_SUBSCRIBER)
return p.writeMessage(&livekit.SignalResponse{ return p.writeMessage(&livekit.SignalResponse{
Message: &livekit.SignalResponse_Offer{ Message: &livekit.SignalResponse_Offer{
Offer: ToProtoSessionDescription(offer), Offer: ToProtoSessionDescription(offer),
+6 -6
View File
@@ -53,7 +53,7 @@ func (p *ParticipantImpl) setCodecPreferencesOpusRedForPublisher(offer webrtc.Se
codecs, err := codecsFromMediaDescription(unmatchAudio) codecs, err := codecsFromMediaDescription(unmatchAudio)
if err != nil { if err != nil {
p.params.Logger.Errorw("extract codecs from media section failed", err, "media", unmatchAudio) p.pubLogger.Errorw("extract codecs from media section failed", err, "media", unmatchAudio)
continue continue
} }
@@ -104,7 +104,7 @@ func (p *ParticipantImpl) setCodecPreferencesOpusRedForPublisher(offer webrtc.Se
bytes, err := parsed.Marshal() bytes, err := parsed.Marshal()
if err != nil { if err != nil {
p.params.Logger.Errorw("failed to marshal offer", err) p.pubLogger.Errorw("failed to marshal offer", err)
return offer return offer
} }
@@ -166,7 +166,7 @@ func (p *ParticipantImpl) setCodecPreferencesVideoForPublisher(offer webrtc.Sess
if mime != "" { if mime != "" {
codecs, err := codecsFromMediaDescription(unmatchVideo) codecs, err := codecsFromMediaDescription(unmatchVideo)
if err != nil { if err != nil {
p.params.Logger.Errorw("extract codecs from media section failed", err, "media", unmatchVideo) p.pubLogger.Errorw("extract codecs from media section failed", err, "media", unmatchVideo)
continue continue
} }
@@ -186,7 +186,7 @@ func (p *ParticipantImpl) setCodecPreferencesVideoForPublisher(offer webrtc.Sess
bytes, err := parsed.Marshal() bytes, err := parsed.Marshal()
if err != nil { if err != nil {
p.params.Logger.Errorw("failed to marshal offer", err) p.pubLogger.Errorw("failed to marshal offer", err)
return offer return offer
} }
@@ -252,7 +252,7 @@ func (p *ParticipantImpl) configurePublisherAnswer(answer webrtc.SessionDescript
opusPT, err := parsed.GetPayloadTypeForCodec(sdp.Codec{Name: "opus"}) opusPT, err := parsed.GetPayloadTypeForCodec(sdp.Codec{Name: "opus"})
if err != nil { if err != nil {
p.params.Logger.Infow("failed to get opus payload type", "error", err, "trakcID", ti.Sid) p.pubLogger.Infow("failed to get opus payload type", "error", err, "trakcID", ti.Sid)
continue continue
} }
@@ -275,7 +275,7 @@ func (p *ParticipantImpl) configurePublisherAnswer(answer webrtc.SessionDescript
bytes, err := parsed.Marshal() bytes, err := parsed.Marshal()
if err != nil { if err != nil {
p.params.Logger.Infow("failed to marshal answer", "error", err) p.pubLogger.Infow("failed to marshal answer", "error", err)
return answer return answer
} }
answer.SDP = string(bytes) answer.SDP = string(bytes)