Move downtrack layer change logic to own function
@@ -431,6 +431,14 @@ func (d *DownTrack) handleRTCP(bytes []byte) {
}
}
if d.trackType == SimulcastDownTrack && maxRatePacketLoss != 0 || expectedMinBitrate != 0 {
+ }
+
+ if len(fwdPkts) > 0 {
+ d.receiver.SendRTCP(fwdPkts)
+ }
+}
+
+func (d *DownTrack) handleLayerChange(maxRatePacketLoss uint8, expectedMinBitrate uint64) {
spatialLayer := atomic.LoadInt32(&d.spatialLayer)
currentSpatialLayer := int64(spatialLayer & 0x0f)
targetSpatialLayer := int64(spatialLayer >> 16)
@@ -475,11 +483,6 @@ func (d *DownTrack) handleRTCP(bytes []byte) {
}
- if len(fwdPkts) > 0 {
- d.receiver.SendRTCP(fwdPkts)
- }
-}
-
func (d *DownTrack) getSRStats() (octets, packets uint32) {
octets = atomic.LoadUint32(&d.octetCount)
packets = atomic.LoadUint32(&d.packetCount)
