Use monotonic time util. (#3112)

Thank you @paulwe for doing this. I was promising to do this for a
while, but just like other times, empty promises :-(
This commit is contained in:
Raja Subramanian
2024-10-17 10:49:24 +05:30
committed by GitHub
parent 19c5ed6343
commit 40b10af960
14 changed files with 23 additions and 117 deletions
+5 -4
View File
@@ -34,6 +34,7 @@ import (
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils/mono"
"github.com/livekit/livekit-server/pkg/sfu/buffer"
"github.com/livekit/livekit-server/pkg/sfu/connectionquality"
@@ -1044,7 +1045,7 @@ func (d *DownTrack) WritePaddingRTP(bytesToSend int, paddingOnMute bool, forceMa
&hdr,
len(payload),
&sendPacketMetadata{
packetTime: d.params.Receiver.GetMonotonicNowUnixNano(),
packetTime: mono.UnixNano(),
extSequenceNumber: snts[i].extSequenceNumber,
extTimestamp: snts[i].extTimestamp,
isPadding: true,
@@ -1590,7 +1591,7 @@ func (d *DownTrack) writeBlankFrameRTP(duration float32, generation uint32) chan
}
d.sendingPacket(&hdr, len(payload), &sendPacketMetadata{
packetTime: d.params.Receiver.GetMonotonicNowUnixNano(),
packetTime: mono.UnixNano(),
extSequenceNumber: snts[i].extSequenceNumber,
extTimestamp: snts[i].extTimestamp,
})
@@ -1954,7 +1955,7 @@ func (d *DownTrack) retransmitPackets(nacks []uint16) {
len(payload),
&sendPacketMetadata{
layer: int32(epm.layer),
packetTime: d.params.Receiver.GetMonotonicNowUnixNano(),
packetTime: mono.UnixNano(),
extSequenceNumber: epm.extSequenceNumber,
extTimestamp: epm.extTimestamp,
isRTX: true,
@@ -2177,7 +2178,7 @@ func (d *DownTrack) sendSilentFrameOnMuteForOpus() {
&hdr,
len(payload),
&sendPacketMetadata{
packetTime: d.params.Receiver.GetMonotonicNowUnixNano(),
packetTime: mono.UnixNano(),
extSequenceNumber: snts[i].extSequenceNumber,
extTimestamp: snts[i].extTimestamp,
// although this is using empty frames, mark as padding as these are used to trigger Pion OnTrack only