diff --git a/index.bs b/index.bs index f3d0baf..a7411bd 100644 --- a/index.bs +++ b/index.bs @@ -86,7 +86,8 @@ argument, ensure that the codec is disabled and produces no output. At construction of each {{RTCRtpSender}} or {{RTCRtpReceiver}}, run the following steps: 2. Initialize [=this=].`[[transform]]` to null. 3. Initialize [=this=].`[[readable]]` to a new {{ReadableStream}}. -4. Set up [=this=].`[[readable]]`. [=this=].`[[readable]]` is provided frames using the [$readEncodedData$] algorithm given |this| as parameter. +4. Set up [=this=].`[[readable]]` with its [=ReadableStream/set up/pullAlgorithm=] set to [$readEncodedData$] given |this| as parameter and its [=ReadableStream/set up/highWaterMark=] set to Infinity. +

highWaterMark is set to Infinity to explicitly disable backpressure. The goal is to limit buffering as much as possible.

5. Set [=this=].`[[readable]]`.`[[owner]]` to |this|. 6. Initialize [=this=].`[[writable]]` to a new {{WritableStream}}. 7. Set up [=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 0. @@ -104,12 +105,16 @@ At construction of each {{RTCRtpSender}} or {{RTCRtpReceiver}}, run the followin ### Stream processing ### {#stream-processing} The readEncodedData algorithm is given a |rtcObject| as parameter. It is defined by running the following steps: -1. Wait for a frame to be produced by |rtcObject|'s encoder if it is a {{RTCRtpSender}} or |rtcObject|'s packetizer if it is a {{RTCRtpReceiver}}. -1. Increment |rtcObject|.`[[lastEnqueuedFrameCounter]]` by 1. -1. Let |frame| be the newly produced frame. -1. Set |frame|.`[[owner]]` to |rtcObject|. -1. Set |frame|.`[[counter]]` to |rtcObject|.`[[lastEnqueuedFrameCounter]]`. -1. [=ReadableStream/Enqueue=] |frame| in |rtcObject|.`[[readable]]`. +1. Let |p| be a new promise. +1. Run the following steps in parallel: + 1. Wait for a frame to be produced by |rtcObject|'s encoder if it is a {{RTCRtpSender}} or |rtcObject|'s packetizer if it is a {{RTCRtpReceiver}}. + 1. Increment |rtcObject|.`[[lastEnqueuedFrameCounter]]` by 1. + 1. Let |frame| be the newly produced frame. + 1. Set |frame|.`[[owner]]` to |rtcObject|. + 1. Set |frame|.`[[counter]]` to |rtcObject|.`[[lastEnqueuedFrameCounter]]`. + 1. [=ReadableStream/Enqueue=] |frame| into |rtcObject|.`[[readable]]`. + 1. Resolve |p| with undefined. +1. return |p|. The writeEncodedData algorithm is given a |rtcObject| as parameter and a |frame| as input. It is defined by running the following steps: 1. If |frame|.`[[owner]]` is not equal to |rtcObject|, abort these steps and return [=a promise resolved with=] undefined. A processor cannot create frames, or move frames between streams.