Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BYOB interfaces to avoid ArrayBuffer churn #41

Closed
tonyherre opened this issue May 31, 2024 · 2 comments · Fixed by #44
Closed

BYOB interfaces to avoid ArrayBuffer churn #41

tonyherre opened this issue May 31, 2024 · 2 comments · Fixed by #44
Labels
Ready for PR Issue discussion has converged

Comments

@tonyherre
Copy link
Contributor

Currently our APIs for reading out payload bytes & Header Extension bytes just pass an ArrayBuffer, but this requires new buffers to be allocated and GCed for every interaction, a cost which adds up at the frequencies & data volumes we're looking at. A bring-your-own-buffer approach would allow apps to maintain their own buffer pools, potentially even directly writing into a WASM memory block, thus avoiding another copy.

WebCodecs has taken this approach with all interfaces have a copyTo(AllowSharedBufferSource destination); method - eg see
https://www.w3.org/TR/webcodecs/#ref-for-dom-encodedaudiochunk-copyto.

I suggest we follow this pattern for RTCRtpPacket.payload and RTCRtpHeaderExtension.value.

@jesup
Copy link

jesup commented May 31, 2024

Makes a ton of sense, for similar reasons to WebCodecs

@aboba
Copy link
Contributor

aboba commented May 31, 2024

I agree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready for PR Issue discussion has converged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants