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
@@ -138,6 +141,7 @@ The <dfn abstract-op>readEncodedData</dfn> algorithm is given a |rtcObject| as p
138
141
1. Increment |rtcObject|.`[[lastEnqueuedFrameCounter]]` by <code>1</code>.
139
142
1. Let |frame| be the newly produced frame.
140
143
1. Set |frame|.`[[owner]]` to |rtcObject|.
144
+
1. Set |this|.`[[writable]]` to |this|.`[[transform]]`.`[[writable]]`.
141
145
1. Set |frame|.`[[counter]]` to |rtcObject|.`[[lastEnqueuedFrameCounter]]`.
142
146
1. If the frame has been produced by a {{RTCRtpReceiver}}:
143
147
1. If the relevant RTP packet contains the
@@ -150,6 +154,7 @@ The <dfn abstract-op>readEncodedData</dfn> algorithm is given a |rtcObject| as p
150
154
[[RTP-EXT-CAPTURE-TIME#timestamp-interpolation|timestamp interpolation]] and set |frame|.`[[senderCaptureTimeOffset]]`
151
155
to the most recent value that was present.
152
156
1. Otherwise, set |frame|.`[[captureTime]]` to undefined and set |frame|.`[[senderCaptureTimeOffset]]` to undefined.
157
+
1. If |frame| was produced by a [=SFrame depacketizer=], set |frame|.`[[useSFrame]]` to true.
153
158
1. If the frame has been produced by a {{RTCRtpSender}}, set |frame|.`[[captureTime]]` to the capture timestamp
154
159
using the methodology described in [[RTP-EXT-CAPTURE-TIME#absolute-capture-timestamp]] and set frame.`[[senderCaptureTimeOffset]]`
155
160
to undefined.
@@ -162,8 +167,10 @@ The <dfn abstract-op>writeEncodedData</dfn> algorithm is given a |rtcObject| as
162
167
1. Let |data| be |frame|.`[[data]]`.
163
168
1. Let |serializedFrame| be [$StructuredSerializeWithTransfer$](|frame|, « |data| »).
164
169
1. Let |frameCopy| be [$StructuredDeserializeWithTransfer$](|serializedFrame|, |frame|'s [=relevant realm=]).
170
+
1. If |frame|.`[[useSFrame]]` is true, set |frameCopy|.`[[useSFrame]]` to true.
165
171
1. Enqueue |frameCopy| for processing as if it came directly from the encoded data source, by running one of the following steps:
166
172
* If |rtcObject| is a {{RTCRtpSender}}, enqueue |frameCopy| to |rtcObject|'s packetizer, to be processed [=in parallel=].
173
+
If |frameCopy|.`[[useSFrame]]` is true, |rtcObject|'s MUST use a [=SFrame packetizer=] or skip processing of |frameCopy|.
167
174
* If |rtcObject| is a {{RTCRtpReceiver}}, enqueue |frameCopy| it to |rtcObject|'s decoder, to be processed [=in parallel=].
168
175
1. Return [=a promise resolved with=] undefined.
169
176
@@ -181,6 +188,7 @@ A RTCRtpTransform has private slots:
181
188
* `[[readable]]` of type {{ReadableStream}}.
182
189
* `[[writable]]` of type {{WritableStream}}.
183
190
* `[[owner]]` of type {{RTCRtpSender}} or {{RTCRtpReceiver}}, initialized to null.
191
+
1. `[[useSFrame]]` of type boolean. // FIXME: Decide whether augmenting this boolean with either cipher suite support or whether doing frame vs. packet based encryption.
184
192
185
193
Each RTCRtpTransform has an <dfn abstract-op for=RTCRtpTransform>association steps</dfn> set, which is empty by default.
186
194
@@ -199,6 +207,16 @@ The `transform` setter steps are:
199
207
1. [=AbortSignal/Add=] the [$chain transform algorithm$] to [=this=].`[[pipeToController]]`'s [=AbortController/signal=].
200
208
2. [=AbortController/signal abort=] on [=this=].`[[pipeToController]]`.
201
209
1. Else, run the [$chain transform algorithm$] steps.
210
+
1. If [=this=] is a {{RTCRtpSender}}, run the following substeps:
211
+
1. Let |useSFrame| be true if [=this=] is configured to use a [=SFrame packetizer=] and false otherwise.
212
+
1. If |useSFrame| is equal to |checkedTransform|.`[[useSFrame]]`, abort these substeps.
213
+
1. Configure [=this=]'s packetizer 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. Otherwise, run the following steps:
216
+
1. Let |useSFrame| be true if [=this=] is configured to use a [=SFrame depacketizer=] and false otherwise.
217
+
1. If |useSFrame| is equal to |checkedTransform|.`[[useSFrame]]`, abort these substeps.
218
+
1. Configure [=this=]'s depacketizer to use SFrame if |checkedTransform|.`[[useSFrame]]` is true and to not use SFrame if |checkedTransform|.`[[useSFrame]]` is false.
219
+
1. [=Update the negotiation-needed flag=] for [=this=]'s connection.
202
220
1. Set [=this=].`[[pipeToController]]` to |newPipeToController|.
203
221
1. Set [=this=].`[[transform]]` to |transform|.
204
222
1. Run the steps in the set of [$association steps$] of |transform| with [=this=].
@@ -248,7 +266,8 @@ SFrameTransform includes GenericTransformStream;
248
266
enum SFrameTransformErrorEventType {
249
267
"authentication",
250
268
"keyID",
251
-
"syntax"
269
+
"syntax",
270
+
"packetization"
252
271
};
253
272
254
273
[Exposed=(Window,DedicatedWorker)]
@@ -275,13 +294,19 @@ The <dfn constructor for="SFrameTransform" lt="SFrameTransform(options)"><code>n
275
294
5. Set |this|.`[[role]]` to |options|["{{SFrameTransformOptions/role}}"].
276
295
6. Set |this|.`[[readable]]` to |this|.`[[transform]]`.`[[readable]]`.
277
296
7. Set |this|.`[[writable]]` to |this|.`[[transform]]`.`[[writable]]`.
297
+
7. Set |this|.`[[useSFrame]]` to true.
278
298
279
299
## Algorithm ## {#sframe-transform-algorithm}
280
300
281
301
The SFrame transform algorithm, given |sframe| as a SFrameTransform object and |frame|, runs these steps:
282
302
1. Let |role| be |sframe|.`[[role]]`.
283
-
1. If |frame|.`[[owner]]` is a {{RTCRtpSender}}, set |role| to 'encrypt'.
284
-
1. If |frame|.`[[owner]]` is a {{RTCRtpReceiver}}, set |role| to 'decrypt'.
303
+
1. If |sframe|.`[[owner]]` is a {{RTCRtpSender}}, set |role| to 'encrypt'.
304
+
1. If |sframe|.`[[owner]]` is a {{RTCRtpReceiver}}, set |role| to 'decrypt'.
305
+
1. If |sframe|.`[[owner]]` is a {{RTCRtpReceiver}} and |frame|.`[[useSFrame]]` is not true, [=queue a task=] to run the following steps:
306
+
1. [=fire an event=] named {{SFrameTransform/onerror|error}} at |sframe|,
307
+
using the {{SFrameTransformErrorEvent}} interface with its {{SFrameTransformErrorEvent/errorType}} attribute set to {{SFrameTransformErrorEventType/packetization}}
308
+
and its {{SFrameTransformErrorEvent/frame}} attribute set to |frame|.
309
+
1. Abort these steps.
285
310
1. Let |data| be undefined.
286
311
1. If |frame| is a {{BufferSource}}, set |data| to |frame|.
287
312
1. If |frame| is a {{RTCEncodedAudioFrame}}, set |data| to |frame|.{{RTCEncodedAudioFrame/data}}
@@ -302,6 +327,7 @@ The SFrame transform algorithm, given |sframe| as a SFrameTransform object and |
302
327
1. If |frame| is a {{BufferSource}}, set |frame| to |buffer|.
303
328
1. If |frame| is a {{RTCEncodedAudioFrame}}, set |frame|.{{RTCEncodedAudioFrame/data}} to |buffer|.
304
329
1. If |frame| is a {{RTCEncodedVideoFrame}}, set |frame|.{{RTCEncodedVideoFrame/data}} to |buffer|.
330
+
1. Set |frame|.`[[useSFrame]]` to true.
305
331
1. [=ReadableStream/Enqueue=] |frame| in |sframe|.`[[transform]]`.
306
332
307
333
## Methods ## {#sframe-transform-methods}
@@ -314,6 +340,27 @@ The <dfn method for="SFrameTransform">setEncryptionKey(|key|, |keyID|)</dfn> met
0 commit comments