Skip to content

Commit fa2fd67

Browse files
committed
Add a note telling why backpressure is disabled
1 parent dd6fe2e commit fa2fd67

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

index.bs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ At construction of each {{RTCRtpSender}} or {{RTCRtpReceiver}}, run the followin
9090
5. Set [=this=].`[[readable]]`.`[[owner]]` to |this|.
9191
6. Initialize [=this=].`[[writable]]` to a new {{WritableStream}}.
9292
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. The goal is to limit buffering as much as possible.</p>
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 latency over reliability, for instance by allowing to drop frames at various places and by using recovery mechanisms.
108+
Buffering within WebRTC encoded transform would add latency without allowing web applications to adapt much.
109+
The User Agent is responsible to do 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)