(ep *ExtPacket, buf []byte)
| 1178 | } |
| 1179 | |
| 1180 | func (b *BufferBase) patchExtPacket(ep *ExtPacket, buf []byte) *ExtPacket { |
| 1181 | n, err := b.getPacketLocked(buf, ep.ExtSequenceNumber) |
| 1182 | if err != nil { |
| 1183 | packetNotFoundCount := b.packetNotFoundCount.Inc() |
| 1184 | if (packetNotFoundCount-1)%20 == 0 { |
| 1185 | b.logger.Warnw( |
| 1186 | "could not get packet from bucket", err, |
| 1187 | "sn", ep.Packet.SequenceNumber, |
| 1188 | "headSN", b.bucket.HeadSequenceNumber(), |
| 1189 | "count", packetNotFoundCount, |
| 1190 | "rtpStats", b.rtpStats, |
| 1191 | "rtpStatsLite", b.rtpStatsLite, |
| 1192 | "snRangeMap", b.snRangeMap, |
| 1193 | ) |
| 1194 | } |
| 1195 | return nil |
| 1196 | } |
| 1197 | ep.RawPacket = buf[:n] |
| 1198 | |
| 1199 | // patch RTP packet to point payload to new buffer |
| 1200 | pkt := *ep.Packet |
| 1201 | payloadStart := ep.Packet.Header.MarshalSize() |
| 1202 | payloadEnd := payloadStart + len(ep.Packet.Payload) |
| 1203 | if payloadEnd > n { |
| 1204 | b.logger.Warnw("unexpected marshal size", nil, "max", n, "need", payloadEnd) |
| 1205 | return nil |
| 1206 | } |
| 1207 | pkt.Payload = buf[payloadStart:payloadEnd] |
| 1208 | ep.Packet = &pkt |
| 1209 | |
| 1210 | return ep |
| 1211 | } |
| 1212 | |
| 1213 | func (b *BufferBase) flushExtPackets() { |
| 1214 | b.Lock() |
no test coverage detected