Skip to content

Commit c18f6ae

Browse files
authored
Merge pull request #195 from youennf/use-infinity-highWaterMark
Use Infinity as highWaterMark value instead of having the sizeAlgorithm returning zero
2 parents 296c9b1 + de1a683 commit c18f6ae

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

index.bs

+11-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ At construction of each {{RTCRtpSender}} or {{RTCRtpReceiver}}, run the followin
8989
4. <a dfn for="ReadableStream">Set up</a> [=this=].`[[readable]]`. [=this=].`[[readable]]` is provided frames using the [$readEncodedData$] algorithm given |this| as parameter.
9090
5. Set [=this=].`[[readable]]`.`[[owner]]` to |this|.
9191
6. Initialize [=this=].`[[writable]]` to a new {{WritableStream}}.
92-
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>.
93-
<p class="note">Chunk size is set to 0 to explictly disable streams backpressure on the write side.</p>
92+
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>.
93+
<p class="note">highWaterMark is set to Infinity to explicitly disable backpressure.</p>
9494
8. Set [=this=].`[[writable]]`.`[[owner]]` to |this|.
9595
9. Initialize [=this=].`[[pipeToController]]` to null.
9696
1. Initialize [=this=].`[[lastReceivedFrameCounter]]` to <code>0</code>.
@@ -101,6 +101,15 @@ At construction of each {{RTCRtpSender}} or {{RTCRtpReceiver}}, run the followin
101101
<!-- FIXME: Use pipeTo algorithm when available. -->
102102
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.
103103

104+
<p class=note>
105+
Streams backpressure can optimize throughput while limiting processing and memory consumption by pausing data production as early as possible in a data pipeline.
106+
This proves useful in contexts where reliability is essential and latency is less of a concern.
107+
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.
108+
Buffering within a transform would add latency without allowing web applications to adapt much.
109+
The User Agent is responsible for doing these adaptations, especially since it controls both ends of the transform.
110+
For those reasons, streams backpressure is disabled in WebRTC encoded transforms.
111+
</p>
112+
104113
### Stream processing ### {#stream-processing}
105114

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

0 commit comments

Comments
 (0)