Log time inversion between incoming packets (#4415)
* Log time inversion between incoming packets Log of timestamp inversion within a red packet did not show anything. Log across packets. Not dropping till there is more evidence of the cause. * save * comment
This commit is contained in:
@@ -45,6 +45,9 @@ type RedPrimaryReceiver struct {
|
|||||||
|
|
||||||
firstPktReceived bool
|
firstPktReceived bool
|
||||||
lastSeq uint16
|
lastSeq uint16
|
||||||
|
lastExtSeq uint64
|
||||||
|
lastTS uint32
|
||||||
|
lastExtTS uint64
|
||||||
|
|
||||||
// bitset for upstream packet receive history [lastSeq-8, lastSeq-1], bit 1 represents packet received
|
// bitset for upstream packet receive history [lastSeq-8, lastSeq-1], bit 1 represents packet received
|
||||||
pktHistory byte
|
pktHistory byte
|
||||||
@@ -107,10 +110,41 @@ func (r *RedPrimaryReceiver) ForwardRTP(pkt *buffer.ExtPacket, spatialLayer int3
|
|||||||
"packetETS", pPkt.ExtTimestamp,
|
"packetETS", pPkt.ExtTimestamp,
|
||||||
"pktHistory", r.pktHistory,
|
"pktHistory", r.pktHistory,
|
||||||
"redHeader", pkt.Packet.Payload[:10],
|
"redHeader", pkt.Packet.Payload[:10],
|
||||||
|
"payloadSize", len(pkt.Packet.Payload),
|
||||||
)
|
)
|
||||||
continue // drop the packet which causes the inversion
|
continue // drop the packet which causes the inversion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if r.lastTS != 0 {
|
||||||
|
if pPkt.ExtSequenceNumber > r.lastExtSeq && pPkt.ExtTimestamp < r.lastExtTS {
|
||||||
|
r.logger.Warnw(
|
||||||
|
"timestamp inversion", nil,
|
||||||
|
"numPackets", len(pkts),
|
||||||
|
"primaryIncomingSN", pkt.Packet.Header.SequenceNumber,
|
||||||
|
"primaryIncomingTS", pkt.Packet.Header.Timestamp,
|
||||||
|
"primaryExtractedSN", pkts[len(pkts)-1].SequenceNumber,
|
||||||
|
"primaryExtractedTS", pkts[len(pkts)-1].Timestamp,
|
||||||
|
"primaryESN", pkt.ExtSequenceNumber,
|
||||||
|
"primaryETS", pkt.ExtTimestamp,
|
||||||
|
"packetIndex", i,
|
||||||
|
"packetExtractedSN", pkts[i].SequenceNumber,
|
||||||
|
"packetESN", pPkt.ExtSequenceNumber,
|
||||||
|
"packetExtractedTS", pkts[i].Timestamp,
|
||||||
|
"packetETS", pPkt.ExtTimestamp,
|
||||||
|
"pktHistory", r.pktHistory,
|
||||||
|
"redHeader", pkt.Packet.Payload[:10],
|
||||||
|
"payloadSize", len(pkt.Packet.Payload),
|
||||||
|
"lastSeq", r.lastSeq,
|
||||||
|
"lastExtSeq", r.lastExtSeq,
|
||||||
|
"lastTS", r.lastTS,
|
||||||
|
"lastExtTS", r.lastExtTS,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
r.lastTS = pPkt.Packet.Header.Timestamp
|
||||||
|
r.lastExtTS = pPkt.ExtTimestamp
|
||||||
|
r.lastExtSeq = pPkt.ExtSequenceNumber
|
||||||
|
|
||||||
// not modify the ExtPacket.RawPacket here for performance since it is not used by the DownTrack,
|
// 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)
|
// otherwise it should be set to the correct value (marshal the primary rtp packet)
|
||||||
r.downTrackSpreader.Broadcast(func(dt TrackSender) {
|
r.downTrackSpreader.Broadcast(func(dt TrackSender) {
|
||||||
|
|||||||
Reference in New Issue
Block a user