fix subscription update on codec change (#757)

This commit is contained in:
cnderrauber
2022-06-10 12:31:34 +08:00
committed by GitHub
parent b81694b664
commit 15da445fd7
3 changed files with 5 additions and 6 deletions
+2 -1
View File
@@ -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