diff --git a/pkg/rtc/mediatracksubscriptions.go b/pkg/rtc/mediatracksubscriptions.go index c9cbff21f..249e29d0f 100644 --- a/pkg/rtc/mediatracksubscriptions.go +++ b/pkg/rtc/mediatracksubscriptions.go @@ -224,9 +224,6 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, wr * }) downTrack.OnMaxLayerChanged(func(dt *sfu.DownTrack, layer int32) { - if dt.Codec().MimeType == "" { - t.params.Logger.Errorw("codec mime type is empty", nil) - } go t.notifySubscriberMaxQuality(subscriberID, dt.Codec(), QualityForSpatialLayer(layer)) }) @@ -438,10 +435,11 @@ func (t *MediaTrackSubscriptions) notifySubscriberMaxQuality(subscriberID liveki } else { maxQuality, ok := t.maxSubscriberQuality[subscriberID] if ok { - if maxQuality.Quality == quality { + if maxQuality.Quality == quality && maxQuality.CodecMime == codec.MimeType { t.maxQualityLock.Unlock() return } + maxQuality.CodecMime = codec.MimeType maxQuality.Quality = quality } else { t.maxSubscriberQuality[subscriberID] = &types.SubscribedCodecQuality{ diff --git a/pkg/rtc/participant.go b/pkg/rtc/participant.go index b9e47a3ef..8cb8f4cf5 100644 --- a/pkg/rtc/participant.go +++ b/pkg/rtc/participant.go @@ -209,7 +209,7 @@ func NewParticipant(params ParticipantParams) (*ParticipantImpl, error) { Config: params.Config, CongestionControlConfig: params.CongestionControlConfig, Telemetry: p.params.Telemetry, - EnabledCodecs: p.params.EnabledCodecs, + EnabledCodecs: enabledCodecs, Logger: LoggerWithPCTarget(params.Logger, livekit.SignalTarget_SUBSCRIBER), }) if err != nil { diff --git a/pkg/sfu/downtrack.go b/pkg/sfu/downtrack.go index b0c3d11be..3fe2b386a 100644 --- a/pkg/sfu/downtrack.go +++ b/pkg/sfu/downtrack.go @@ -694,7 +694,8 @@ func (d *DownTrack) SetMaxSpatialLayer(spatialLayer int32) { return } - if d.onMaxLayerChanged != nil && d.kind == webrtc.RTPCodecTypeVideo && maxLayers.SpatialGreaterThanOrEqual(currentLayers) { + if d.onMaxLayerChanged != nil && d.kind == webrtc.RTPCodecTypeVideo && + maxLayers.SpatialGreaterThanOrEqual(currentLayers) && d.bound.Load() { // // Notify when new max is // 1. Equal to current -> already locked to the new max