Add some more logging around migration. (#4426)
Some e2e is failing due to subscriptions happening late and the expected order of m-lines is different. Not a hard failure, but logging more to make seeing this easie.
This commit is contained in:
+21
-1
@@ -191,6 +191,19 @@ type trackDescription struct {
|
||||
sender *webrtc.RTPSender
|
||||
}
|
||||
|
||||
func (t trackDescription) MarshalLogObject(e zapcore.ObjectEncoder) error {
|
||||
e.AddString("mid", t.mid)
|
||||
if t.sender != nil {
|
||||
track := t.sender.Track()
|
||||
if track != nil {
|
||||
e.AddString("trackID", track.ID())
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// PCTransport is a wrapper around PeerConnection, with some helper methods
|
||||
type PCTransport struct {
|
||||
params TransportParams
|
||||
@@ -2159,6 +2172,7 @@ func (t *PCTransport) initPCWithPreviousAnswer(previousAnswer webrtc.SessionDesc
|
||||
}
|
||||
mid := lksdp.GetMidValue(m)
|
||||
if mid == "" {
|
||||
t.params.Logger.Warnw("cannot set up peer connection with previous answer, mid not found", nil, "senders", slices.Collect(maps.Keys(senders)))
|
||||
return senders, ErrMidNotFound
|
||||
}
|
||||
tr.SetMid(mid)
|
||||
@@ -2170,6 +2184,7 @@ func (t *PCTransport) initPCWithPreviousAnswer(previousAnswer webrtc.SessionDesc
|
||||
// set transceiver to inactive
|
||||
tr.SetSender(sender, nil)
|
||||
}
|
||||
t.params.Logger.Debugw("set up peer connection with previous answer", "senders", slices.Collect(maps.Keys(senders)))
|
||||
return senders, nil
|
||||
}
|
||||
|
||||
@@ -2205,7 +2220,7 @@ func (t *PCTransport) SetPreviousSdp(localDescription, remoteDescription *webrtc
|
||||
}
|
||||
|
||||
if localDescription != nil && parseMids {
|
||||
// in migration case, can't reuse transceiver before negotiating excepted tracks
|
||||
// in migration case, can't reuse transceiver before negotiating expected tracks
|
||||
// that were subscribed at previous node
|
||||
t.canReuseTransceiver = false
|
||||
if err := t.parseTrackMid(*localDescription, senders); err != nil {
|
||||
@@ -2249,6 +2264,9 @@ func (t *PCTransport) parseTrackMid(sd webrtc.SessionDescription, senders map[st
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(t.previousTrackDescription) != 0 {
|
||||
t.params.Logger.Debugw("previous track description", t.previousTrackDescription)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -2689,6 +2707,7 @@ func (t *PCTransport) setRemoteDescription(sd webrtc.SessionDescription) error {
|
||||
if !t.canReuseTransceiver {
|
||||
t.canReuseTransceiver = true
|
||||
t.previousTrackDescription = make(map[string]*trackDescription)
|
||||
t.params.Logger.Debugw("enabling transceiver reuse")
|
||||
}
|
||||
t.lock.Unlock()
|
||||
}
|
||||
@@ -2771,6 +2790,7 @@ func (t *PCTransport) createAndSendAnswer() error {
|
||||
if !t.canReuseTransceiver {
|
||||
t.canReuseTransceiver = true
|
||||
t.previousTrackDescription = make(map[string]*trackDescription)
|
||||
t.params.Logger.Debugw("enabling transceiver reuse")
|
||||
}
|
||||
t.lock.Unlock()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user