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:
Raja Subramanian
2025-11-06 13:29:21 +05:30
committed by GitHub
parent d0ba46b460
commit 4872f2051d
5 changed files with 13 additions and 23 deletions
+2 -6
View File
@@ -66,9 +66,7 @@ func (r *RedPrimaryReceiver) ForwardRTP(pkt *buffer.ExtPacket, spatialLayer int3
// forward non-red packet directly
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()
}
@@ -93,9 +91,7 @@ func (r *RedPrimaryReceiver) ForwardRTP(pkt *buffer.ExtPacket, spatialLayer int3
// not modify the ExtPacket.RawPacket here for performance since it is not used by the DownTrack,
// otherwise it should be set to the correct value (marshal the primary rtp packet)
r.downTrackSpreader.Broadcast(func(dt TrackSender) {
if dt.WriteRTP(&pPkt, spatialLayer) {
writeCount.Inc()
}
writeCount.Add(dt.WriteRTP(&pPkt, spatialLayer))
})
}
return writeCount.Load()