- From: henbos via GitHub <sysbot+gh@w3.org>
- Date: Mon, 07 Oct 2024 11:39:52 +0000
- To: public-webrtc-logs@w3.org
henbos has just created a new issue for https://github.com/w3c/webrtc-rtptransport: == API creates per-packet temporary objects, this is not ideal for GC == `RTCRtpPacket.copyPayloadTo(buffer)` avoids the GC overhead of the payload with BYOB, but not the rest of the packet. ``` interface RTCRtpTransport { sequence<RTCRtpPacket> readPacketizedRtp(unsigned long maxNumberOfPackets); ... }; ``` While the overhead of the packet in terms of bytes is small we still have the problem of garbage collection. For every packet we create a temporary `RTCRtpPacket` which needs to be GC'd, this could be over a thousand times per second. # Proposal: BYOP (Bring Your Own Packets) The app tells the transport where to store the packets we read instead of creating temporaries. Changes to the API: ``` interface RTCRtpPacket { constructor(); ... }; interface RTCRtpTransport { int readPacketizedRtp(sequence<RTCRtpPacket> packets); ... }; ``` Example usage: ``` // One-time setup const receivePackets = new RTCRtpPacket[kMaxNumberOfPackets]; for (let i = 0; i < kMaxNumberOfPackets; ++i) { receivePackets[i] = new RTCRtpPacket(); } // Repeatedly const packetsRead = transport.readPacketizedRtp(receivePackets); for (let i = 0; i < packetsRead; ++i) { handlePacket(receivePackets[i]); } ``` CC @handellm Please view or discuss this issue at https://github.com/w3c/webrtc-rtptransport/issues/77 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 7 October 2024 11:39:53 UTC