w3c / webrtc-rtptransport

Repository for the RTPTransport specification of the WebRTC Working Group
Other
15 stars 5 forks source link

Controls of internal queue lengths #54

Open tonyherre opened 2 weeks ago

tonyherre commented 2 weeks ago

If we have batched read APIs (or even ReadableStreams) for getting high frequency data to JS eg received RTP packets, remote acks of sent packets, etc, then the browser will need to keep a buffer of unread events (directly in batch APIs or eg in an UnderlyingSource for a ReadableStream). This buffer will have a bounded size, but the size isn't currently observable or controlable from JS.

Do we need a way for JS to control the length of these queues? eg WebTransport has incomingMaxAge, outgoingMaxAge as came up in https://github.com/w3c/webrtc-rtptransport/pull/42#issuecomment-2142665283.

tonyherre commented 2 weeks ago

I also opened #55 for stats so JS can observe these drops.

I'm not that sure whether JS would actually need to control the max length of these queues tbh - it might know how often it's going to read, and the likely packet frequency coming, but the other side of the tradeoff is just memory consumption - wouldn't the browser be best placed to evaluate that tradeoff? Any extra knowledge the app would have that I've missed?

Maybe just exposing readonly incomingMaxAge and outgoingMaxAge decided by the browser would be enough, so JS knows how often to query to ensure no data is lost?

CC those who commented on the review on #42: @aboba @Philipel-WebRTC @youennf @pthatcher