@@ -220,3 +220,39 @@ partial interface RTCRtpReceiver {
220
220
};
221
221
222
222
</pre >
223
+
224
+ ## Design considerations, alternatives considered ##
225
+
226
+ This design is built upon the Streams API. This is a natural interface
227
+ for stuff that can be considered a "sequence of objects", and has an ecosystem
228
+ around it that allows some concerns to be handed off easily.
229
+
230
+ In particular:
231
+
232
+ * Sequencing comes naturally; streams are in-order entities.
233
+ * With the Transferable Streams paradigm, changing what thread is doing
234
+ the processing can be done in a manner that has been tested by others.
235
+ * Since other users of Streams interfaces are going to deal with issues
236
+ like efficient handover and WASM interaction, we can expect to leverage
237
+ common solutions for these problems.
238
+
239
+ There are some challenges with the Streams interface:
240
+
241
+ * Queueing in response to backpressure isn't an appropriate reaction in a
242
+ real-time environment. This can be mitigated at the sender by not queueing,
243
+ preferring to discard frames or not generating them.
244
+ * How to interface to congestion control signals, which travel in the
245
+ opposite direction from the streams flow.
246
+ * How to integrate error signalling and recovery, given that most of the
247
+ time, breaking the pipeline is not an appropriate action.
248
+
249
+ The alternatives involve callback-based or event-based interfaces; those
250
+ would require developing new interfaces that allow the relevant WebRTC
251
+ objects to be visible in the worker context in order to do processing off
252
+ the main thread. This is complex.
253
+
254
+ Experimentation with the prototype API seems to show that performance is
255
+ adequate for real-time processing; the streaming part is not contributing
256
+ very much to slowing down the pipelines.
257
+
258
+
0 commit comments