Return write count from WriteRTP. (#4059)
* Log write count atomic. * Return write count from WriteRTP. Apologies for the frequent changes on this. With relays, the down track could write to several targets. So, use count to have an accurate indication of how may subscribers were written to.
This commit is contained in:
@@ -68,9 +68,7 @@ func (r *RedReceiver) ForwardRTP(pkt *buffer.ExtPacket, spatialLayer int32) int3
|
||||
if len(pkt.Packet.Payload) >= maxRedPayload {
|
||||
var writeCount atomic.Int32
|
||||
r.downTrackSpreader.Broadcast(func(dt TrackSender) {
|
||||
if dt.WriteRTP(pkt, spatialLayer) {
|
||||
writeCount.Inc()
|
||||
}
|
||||
writeCount.Add(dt.WriteRTP(pkt, spatialLayer))
|
||||
})
|
||||
return writeCount.Load()
|
||||
}
|
||||
@@ -91,9 +89,7 @@ func (r *RedReceiver) ForwardRTP(pkt *buffer.ExtPacket, spatialLayer int32) int3
|
||||
// otherwise it should be set to the correct value (marshal the primary rtp packet)
|
||||
var writeCount atomic.Int32
|
||||
r.downTrackSpreader.Broadcast(func(dt TrackSender) {
|
||||
if dt.WriteRTP(&pPkt, spatialLayer) {
|
||||
writeCount.Inc()
|
||||
}
|
||||
writeCount.Add(dt.WriteRTP(&pPkt, spatialLayer))
|
||||
})
|
||||
return writeCount.Load()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user