You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.bs
+75-23
Original file line number
Diff line number
Diff line change
@@ -138,6 +138,7 @@ The <dfn abstract-op>readEncodedData</dfn> algorithm is given a |rtcObject| as p
138
138
1. Increment |rtcObject|.`[[lastEnqueuedFrameCounter]]` by <code>1</code>.
139
139
1. Let |frame| be the newly produced frame.
140
140
1. Set |frame|.`[[owner]]` to |rtcObject|.
141
+
1. Set |this|.`[[writable]]` to |this|.`[[transform]]`.`[[writable]]`.
141
142
1. Set |frame|.`[[counter]]` to |rtcObject|.`[[lastEnqueuedFrameCounter]]`.
142
143
1. If the frame has been produced by a {{RTCRtpReceiver}}:
143
144
1. If the relevant RTP packet contains the
@@ -150,6 +151,7 @@ The <dfn abstract-op>readEncodedData</dfn> algorithm is given a |rtcObject| as p
150
151
[[RTP-EXT-CAPTURE-TIME#timestamp-interpolation|timestamp interpolation]] and set |frame|.`[[senderCaptureTimeOffset]]`
151
152
to the most recent value that was present.
152
153
1. Otherwise, set |frame|.`[[captureTime]]` to undefined and set |frame|.`[[senderCaptureTimeOffset]]` to undefined.
154
+
1. If |frame| was produced by a [=SFrame depacketizer=], set |frame|.`[[useSFrame]]` to true.
153
155
1. If the frame has been produced by a {{RTCRtpSender}}, set |frame|.`[[captureTime]]` to the capture timestamp
154
156
using the methodology described in [[RTP-EXT-CAPTURE-TIME#absolute-capture-timestamp]] and set frame.`[[senderCaptureTimeOffset]]`
155
157
to undefined.
@@ -162,8 +164,10 @@ The <dfn abstract-op>writeEncodedData</dfn> algorithm is given a |rtcObject| as
162
164
1. Let |data| be |frame|.`[[data]]`.
163
165
1. Let |serializedFrame| be [$StructuredSerializeWithTransfer$](|frame|, « |data| »).
164
166
1. Let |frameCopy| be [$StructuredDeserializeWithTransfer$](|serializedFrame|, |frame|'s [=relevant realm=]).
167
+
1. If |frame|.`[[useSFrame]]` is true, set |frameCopy|.`[[useSFrame]]` to true.
165
168
1. Enqueue |frameCopy| for processing as if it came directly from the encoded data source, by running one of the following steps:
166
169
* If |rtcObject| is a {{RTCRtpSender}}, enqueue |frameCopy| to |rtcObject|'s packetizer, to be processed [=in parallel=].
170
+
If |frameCopy|.`[[useSFrame]]` is true, |rtcObject|'s MUST use a [=SFrame packetizer=] or skip processing of |frameCopy|.
167
171
* If |rtcObject| is a {{RTCRtpReceiver}}, enqueue |frameCopy| it to |rtcObject|'s decoder, to be processed [=in parallel=].
168
172
1. Return [=a promise resolved with=] undefined.
169
173
@@ -177,26 +181,40 @@ As [$writeEncodedData$] ensures that the transform cannot reorder frames, this w
177
181
178
182
## Extension attribute ## {#attribute}
179
183
180
-
A RTCRtpTransform has two private slots called `[[readable]]` and `[[writable]]`.
184
+
A RTCRtpTransform has the following private slots:
185
+
1. `[[readable]]` of type {{ReadableStream}}.
186
+
1. `[[writable]]` of type {{WritableStream}}.
187
+
1. `[[owner]]` of type {{RTCRtpSender}} or {{RTCRtpReceiver}}.
188
+
1. `[[useSFrame]]` of type boolean.
181
189
182
190
Each RTCRtpTransform has an <dfn abstract-op for=RTCRtpTransform>association steps</dfn> set, which is empty by default.
183
191
184
192
The <dfn attribute for="RTCRtpSender,RTCRtpReceiver">transform</dfn> getter steps are:
185
193
1. Return [=this=].`[[transform]]`.
186
194
187
195
The `transform` setter steps are:
188
-
2. Let |transform| be the argument to the setter.
189
-
3. Let |checkedTransform| set to |transform| if it is not null or to an [=identity transform stream=] otherwise.
190
-
3. Let |reader| be the result of [=ReadableStream/getting a reader=] for |checkedTransform|.`[[readable]]`.
191
-
4. Let |writer| be the result of [=WritableStream/getting a writer=] for |checkedTransform|.`[[writable]]`.
192
-
5. Initialize |newPipeToController| to a new {{AbortController}}.
193
-
6. If [=this=].`[[pipeToController]]` is not null, run the following steps:
196
+
1. Let |transform| be the argument to the setter.
197
+
1. Let |checkedTransform| set to |transform| if it is not null or to an [=identity transform stream=] otherwise.
198
+
1. Let |reader| be the result of [=ReadableStream/getting a reader=] for |checkedTransform|.`[[readable]]`.
199
+
1. Let |writer| be the result of [=WritableStream/getting a writer=] for |checkedTransform|.`[[writable]]`.
200
+
1. Initialize |newPipeToController| to a new {{AbortController}}.
201
+
1. If [=this=].`[[pipeToController]]` is not null, run the following steps:
194
202
1. [=AbortSignal/Add=] the [$chain transform algorithm$] to [=this=].`[[pipeToController]]`'s [=AbortController/signal=].
195
203
2. [=AbortController/signal abort=] on [=this=].`[[pipeToController]]`.
196
-
7. Else, run the [$chain transform algorithm$] steps.
197
-
8. Set [=this=].`[[pipeToController]]` to |newPipeToController|.
198
-
9. Set [=this=].`[[transform]]` to |transform|.
199
-
10. Run the steps in the set of [$association steps$] of |transform| with [=this=].
204
+
1. Else, run the [$chain transform algorithm$] steps.
205
+
1. If [=this=] is a {{RTCRtpSender}}, run the following substeps:
206
+
1. Let |useSFrame| be true if [=this=] is configured to use a [=SFrame packetizer=] and false otherwise.
207
+
1. If |useSFrame| is equal to |checkedTransform|.`[[useSFrame]]`, abort these substeps.
208
+
1. Configure [=this=]'s packetizer to use SFrame if |checkedTransform|.`[[useSFrame]]` is true and to not use SFrame if |checkedTransform|.`[[useSFrame]]` is false.
209
+
1. [=Update the negotiation-needed flag=] for [=this=]'s connection.
210
+
1. Otherwise, run the following steps:
211
+
1. Let |useSFrame| be true if [=this=] is configured to use a [=SFrame depacketizer=] and false otherwise.
212
+
1. If |useSFrame| is equal to |checkedTransform|.`[[useSFrame]]`, abort these substeps.
213
+
1. Configure [=this=]'s depacketizer to use SFrame if |checkedTransform|.`[[useSFrame]]` is true and to not use SFrame if |checkedTransform|.`[[useSFrame]]` is false.
214
+
1. [=Update the negotiation-needed flag=] for [=this=]'s connection.
215
+
1. Set [=this=].`[[pipeToController]]` to |newPipeToController|.
216
+
1. Set [=this=].`[[transform]]` to |transform|.
217
+
1. Run the steps in the set of [$association steps$] of |transform| with [=this=].
200
218
201
219
The <dfn abstract-op>chain transform algorithm</dfn> steps are defined as:
202
220
1. If |newPipeToController|'s [=AbortController/signal=] is [=AbortSignal/aborted=], abort these steps.
@@ -243,7 +261,8 @@ SFrameTransform includes GenericTransformStream;
243
261
enum SFrameTransformErrorEventType {
244
262
"authentication",
245
263
"keyID",
246
-
"syntax"
264
+
"syntax",
265
+
"packetization"
247
266
};
248
267
249
268
[Exposed=(Window,DedicatedWorker)]
@@ -270,13 +289,19 @@ The <dfn constructor for="SFrameTransform" lt="SFrameTransform(options)"><code>n
270
289
5. Set |this|.`[[role]]` to |options|["{{SFrameTransformOptions/role}}"].
271
290
6. Set |this|.`[[readable]]` to |this|.`[[transform]]`.`[[readable]]`.
272
291
7. Set |this|.`[[writable]]` to |this|.`[[transform]]`.`[[writable]]`.
292
+
7. Set |this|.`[[useSFrame]]` to true.
273
293
274
294
## Algorithm ## {#sframe-transform-algorithm}
275
295
276
296
The SFrame transform algorithm, given |sframe| as a SFrameTransform object and |frame|, runs these steps:
277
297
1. Let |role| be |sframe|.`[[role]]`.
278
-
1. If |frame|.`[[owner]]` is a {{RTCRtpSender}}, set |role| to 'encrypt'.
279
-
1. If |frame|.`[[owner]]` is a {{RTCRtpReceiver}}, set |role| to 'decrypt'.
298
+
1. If |sframe|.`[[owner]]` is a {{RTCRtpSender}}, set |role| to 'encrypt'.
299
+
1. If |sframe|.`[[owner]]` is a {{RTCRtpReceiver}}, set |role| to 'decrypt'.
300
+
1. If |sframe|.`[[owner]]` is a {{RTCRtpReceiver}} and |frame|.`[[useSFrame]]` is not true, [=queue a task=] to run the following steps:
301
+
1. [=fire an event=] named {{SFrameTransform/onerror|error}} at |sframe|,
302
+
using the {{SFrameTransformErrorEvent}} interface with its {{SFrameTransformErrorEvent/errorType}} attribute set to {{SFrameTransformErrorEventType/packetization}}
303
+
and its {{SFrameTransformErrorEvent/frame}} attribute set to |frame|.
304
+
1. Abort these steps.
280
305
1. Let |data| be undefined.
281
306
1. If |frame| is a {{BufferSource}}, set |data| to |frame|.
282
307
1. If |frame| is a {{RTCEncodedAudioFrame}}, set |data| to |frame|.{{RTCEncodedAudioFrame/data}}
@@ -297,6 +322,7 @@ The SFrame transform algorithm, given |sframe| as a SFrameTransform object and |
297
322
1. If |frame| is a {{BufferSource}}, set |frame| to |buffer|.
298
323
1. If |frame| is a {{RTCEncodedAudioFrame}}, set |frame|.{{RTCEncodedAudioFrame/data}} to |buffer|.
299
324
1. If |frame| is a {{RTCEncodedVideoFrame}}, set |frame|.{{RTCEncodedVideoFrame/data}} to |buffer|.
325
+
1. Set |frame|.`[[useSFrame]]` to true.
300
326
1. [=ReadableStream/Enqueue=] |frame| in |sframe|.`[[transform]]`.
301
327
302
328
## Methods ## {#sframe-transform-methods}
@@ -309,6 +335,27 @@ The <dfn method for="SFrameTransform">setEncryptionKey(|key|, |keyID|)</dfn> met
0 commit comments