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) {
|
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))
|
go t.notifySubscriberMaxQuality(subscriberID, dt.Codec(), QualityForSpatialLayer(layer))
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -438,10 +435,11 @@ func (t *MediaTrackSubscriptions) notifySubscriberMaxQuality(subscriberID liveki
|
|||||||
} else {
|
} else {
|
||||||
maxQuality, ok := t.maxSubscriberQuality[subscriberID]
|
maxQuality, ok := t.maxSubscriberQuality[subscriberID]
|
||||||
if ok {
|
if ok {
|
||||||
if maxQuality.Quality == quality {
|
if maxQuality.Quality == quality && maxQuality.CodecMime == codec.MimeType {
|
||||||
t.maxQualityLock.Unlock()
|
t.maxQualityLock.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
maxQuality.CodecMime = codec.MimeType
|
||||||
maxQuality.Quality = quality
|
maxQuality.Quality = quality
|
||||||
} else {
|
} else {
|
||||||
t.maxSubscriberQuality[subscriberID] = &types.SubscribedCodecQuality{
|
t.maxSubscriberQuality[subscriberID] = &types.SubscribedCodecQuality{
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ func NewParticipant(params ParticipantParams) (*ParticipantImpl, error) {
|
|||||||
Config: params.Config,
|
Config: params.Config,
|
||||||
CongestionControlConfig: params.CongestionControlConfig,
|
CongestionControlConfig: params.CongestionControlConfig,
|
||||||
Telemetry: p.params.Telemetry,
|
Telemetry: p.params.Telemetry,
|
||||||
EnabledCodecs: p.params.EnabledCodecs,
|
EnabledCodecs: enabledCodecs,
|
||||||
Logger: LoggerWithPCTarget(params.Logger, livekit.SignalTarget_SUBSCRIBER),
|
Logger: LoggerWithPCTarget(params.Logger, livekit.SignalTarget_SUBSCRIBER),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -694,7 +694,8 @@ func (d *DownTrack) SetMaxSpatialLayer(spatialLayer int32) {
|
|||||||
return
|
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
|
// Notify when new max is
|
||||||
// 1. Equal to current -> already locked to the new max
|
// 1. Equal to current -> already locked to the new max
|
||||||
|
|||||||
Reference in New Issue
Block a user