Some optimisations in the forwarding path. (#2035)
* WIP commit * WIP * Fix tests * clean up * Release pool in pacer * fix tests * fix tests * remove debug * fix test
This commit is contained in:
+21
-10
@@ -67,7 +67,9 @@ type packetMeta struct {
|
||||
// Spatial layer of packet
|
||||
layer int8
|
||||
// Information that differs depending on the codec
|
||||
codecBytes []byte
|
||||
codecBytes [8]byte
|
||||
numCodecBytesIn uint8
|
||||
numCodecBytesOut uint8
|
||||
// Dependency Descriptor of packet
|
||||
ddBytes []byte
|
||||
}
|
||||
@@ -127,6 +129,7 @@ func (s *sequencer) push(
|
||||
marker bool,
|
||||
layer int8,
|
||||
codecBytes []byte,
|
||||
numCodecBytesIn int,
|
||||
ddBytes []byte,
|
||||
) {
|
||||
s.Lock()
|
||||
@@ -190,15 +193,23 @@ func (s *sequencer) push(
|
||||
|
||||
slot := extModifiedSNAdjusted % uint64(s.size)
|
||||
s.meta[slot] = packetMeta{
|
||||
sourceSeqNo: uint16(extIncomingSN),
|
||||
targetSeqNo: uint16(extModifiedSN),
|
||||
timestamp: uint32(extModifiedTS),
|
||||
marker: marker,
|
||||
layer: layer,
|
||||
codecBytes: append([]byte{}, codecBytes...),
|
||||
ddBytes: append([]byte{}, ddBytes...),
|
||||
lastNack: s.getRefTime(packetTime), // delay retransmissions after the original transmission
|
||||
sourceSeqNo: uint16(extIncomingSN),
|
||||
targetSeqNo: uint16(extModifiedSN),
|
||||
timestamp: uint32(extModifiedTS),
|
||||
marker: marker,
|
||||
layer: layer,
|
||||
numCodecBytesIn: uint8(numCodecBytesIn),
|
||||
ddBytes: append([]byte{}, ddBytes...),
|
||||
lastNack: s.getRefTime(packetTime), // delay retransmissions after the original transmission
|
||||
}
|
||||
pm := &s.meta[slot]
|
||||
pm.numCodecBytesOut = uint8(len(codecBytes))
|
||||
if pm.numCodecBytesOut > uint8(len(pm.codecBytes)) {
|
||||
s.logger.Errorw("codec bytes too large", nil, "need", pm.numCodecBytesOut, "bufSize", len(pm.codecBytes))
|
||||
s.invalidateSlot(int(slot))
|
||||
return
|
||||
}
|
||||
copy(pm.codecBytes[:pm.numCodecBytesOut], codecBytes)
|
||||
|
||||
if extModifiedSN > s.extHighestSN {
|
||||
s.extHighestSN = extModifiedSN
|
||||
@@ -322,7 +333,7 @@ func (s *sequencer) getExtPacketMetas(seqNo []uint16) []extPacketMeta {
|
||||
extSequenceNumber: extSN,
|
||||
extTimestamp: extTS,
|
||||
}
|
||||
epm.codecBytes = append([]byte{}, meta.codecBytes...)
|
||||
copy(epm.codecBytes[:epm.numCodecBytesOut], meta.codecBytes[:epm.numCodecBytesOut])
|
||||
epm.ddBytes = append([]byte{}, meta.ddBytes...)
|
||||
extPacketMetas = append(extPacketMetas, epm)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user