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

Use Infinity as highWaterMark value instead of having the sizeAlgorithm returning zero #195

Merged
merged 5 commits into from
Jul 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ At construction of each {{RTCRtpSender}} or {{RTCRtpReceiver}}, run the followin
4. <a dfn for="ReadableStream">Set up</a> [=this=].`[[readable]]`. [=this=].`[[readable]]` is provided frames using the [$readEncodedData$] algorithm given |this| as parameter.
5. Set [=this=].`[[readable]]`.`[[owner]]` to |this|.
6. Initialize [=this=].`[[writable]]` to a new {{WritableStream}}.
7. <a dfn for="WritableStream">Set up</a> [=this=].`[[writable]]` with its [=WritableStream/set up/writeAlgorithm=] set to [$writeEncodedData$] given |this| as parameter and its [=WritableStream/set up/sizeAlgorithm=] to an algorithm that returns <code>0</code>.
<p class="note">Chunk size is set to 0 to explictly disable streams backpressure on the write side.</p>
7. <a dfn for="WritableStream">Set up</a> [=this=].`[[writable]]` with its [=WritableStream/set up/writeAlgorithm=] set to [$writeEncodedData$] given |this| as parameter and its [=WritableStream/set up/highWaterMark=] set to <code>Infinity</code>.
<p class="note">highWaterMark is set to Infinity to explicitly disable backpressure.</p>
8. Set [=this=].`[[writable]]`.`[[owner]]` to |this|.
9. Initialize [=this=].`[[pipeToController]]` to null.
1. Initialize [=this=].`[[lastReceivedFrameCounter]]` to <code>0</code>.
Expand All @@ -101,6 +101,15 @@ At construction of each {{RTCRtpSender}} or {{RTCRtpReceiver}}, run the followin
<!-- FIXME: Use pipeTo algorithm when available. -->
3. Call <a href="https://streams.spec.whatwg.org/#readable-stream-pipe-to">pipeTo</a> with [=this=].`[[readable]]`, [=this=].`[[writable]]`, preventClose equal to true, preventAbort equal to true, preventCancel equal to true and [=this=].`[[pipeToController]]`.signal.

<p class=note>
Streams backpressure can optimize throughput while limiting processing and memory consumption by pausing data production as early as possible in a data pipeline.
This proves useful in contexts where reliability is essential and latency is less of a concern.
On the other hand, WebRTC media pipelines favour low latency over reliability, for instance by allowing to drop frames at various places and by using recovery mechanisms.
Buffering within a transform would add latency without allowing web applications to adapt much.
The User Agent is responsible for doing these adaptations, especially since it controls both ends of the transform.
For those reasons, streams backpressure is disabled in WebRTC encoded transforms.
</p>

### Stream processing ### {#stream-processing}

The <dfn abstract-op>readEncodedData</dfn> algorithm is given a |rtcObject| as parameter. It is defined by running the following steps:
Expand Down
Loading