diff --git a/pkg/rtc/mediatrack.go b/pkg/rtc/mediatrack.go index f492930e3..4095013fa 100644 --- a/pkg/rtc/mediatrack.go +++ b/pkg/rtc/mediatrack.go @@ -190,6 +190,7 @@ func (t *MediaTrack) SetPendingCodecSid(codecs []*livekit.SimulcastCodec) { } } t.params.TrackInfo = ti + t.MediaTrackReceiver.UpdateTrackInfo(ti) } // AddReceiver adds a new RTP receiver to the track, returns true when receiver represents a new codec diff --git a/pkg/rtc/participant_sdp.go b/pkg/rtc/participant_sdp.go index 524a487fb..427c846a5 100644 --- a/pkg/rtc/participant_sdp.go +++ b/pkg/rtc/participant_sdp.go @@ -112,8 +112,15 @@ func (p *ParticipantImpl) setCodecPreferencesVideoForPublisher(offer webrtc.Sess continue } + var info *livekit.TrackInfo p.pendingTracksLock.RLock() - _, info := p.getPendingTrack(streamID, livekit.TrackType_VIDEO) + mt := p.getPublishedTrackBySdpCid(streamID) + if mt != nil { + info = mt.ToProto() + } else { + _, info = p.getPendingTrack(streamID, livekit.TrackType_VIDEO) + } + if info == nil { p.pendingTracksLock.RUnlock() continue