mirror of
https://github.com/livekit/livekit.git
synced 2026-07-21 04:41:11 +00:00
fix subscription update on codec change (#757)
This commit is contained in:
@@ -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{
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user