瀏覽代碼

fix RTP payload aliasing in jitter buffer

Copy RTP payload bytes when parsing packets so buffered packets do not retain slices into the shared UDP read buffer.

Previously ParseRTPPacket() kept Payload as a subslice of the caller-provided buffer. Once the next ReadFromUDP() reused that buffer, any packet still waiting inside the jitter buffer would silently see corrupted payload data. In practice this could surface as clicks, artifacts, or silent audio on reordered AES67/RTP traffic without obvious decoder errors.

Take an owned copy of the payload on parse so jitter-buffered packets remain stable even when the source read buffer is reused.
main
Jan 1 月之前
父節點
當前提交
939240df31
共有 1 個檔案被更改,包括 5 行新增1 行删除
  1. +5
    -1
      aoiprxkit/rtp.go

+ 5
- 1
aoiprxkit/rtp.go 查看文件

@@ -63,6 +63,10 @@ func ParseRTPPacket(buf []byte) (RTPPacket, error) {
}
payload = payload[:len(payload)-padLen]
}
p.Payload = payload
// ALIASING FIX: copy payload bytes before returning. The caller reuses
// the receive buffer on every ReadFromUDP call, so any RTPPacket stored
// in the jitter buffer for later delivery would have its Payload slice
// silently overwritten by the next incoming packet.
p.Payload = append([]byte(nil), payload...)
return p, nil
}

Loading…
取消
儲存