w3c / media-pipeline-arch

Architecture of the media pipeline on the web
Other
7 stars 0 forks source link

Transport: Concurrency in reliable/unordered (frame/stream) transport #10

Open aboba opened 1 year ago

aboba commented 1 year ago

Frame/stream transport is proving popular in WebTransport because it removes head-of-line blocking, simplifies framing and enables partial reliability. However, the complexity of optimizing reading and writing in frame/stream mode suggests a gap in the WebTransport API, to either be filled by a library or WebTransport API additions.

In the WebCodecs-WebTransport echo sample it has proven tricky to optimize writing and reading in frame/stream transport. Since I-frames are 10+x larger than P-frames, it would be ideal to be able to write and read several frames concurrently.

async function writeChunk(transport, chunk, rto, info) attempts to write a chunk to a unidirectional stream, with partial reliability, based on expiration timer of duration rto, without blocking (e.g. no awaits).

Achieving concurrency on the read side is more complex, because it is necessary to read from several unidirectional streams concurrently. Currently async function get_frame(readable, number) still uses await which limits the ability to read from several incoming unidirectional streams at the same time.