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
The <dfn constructor for="SFrameTransform" lt="SFrameTransform(options)"><code>new SFrameTransform(<var>options</var>)</code></dfn> constructor steps are:
276
-
1. Let |transformAlgorithm| be an algorithm which takes a |frame| as input and runs the <a href="#sframe-transform-algorithm">SFrame transform algorithm</a> with |this| and |frame|.
287
+
1. Let |options| be the method's first argument.
288
+
1. Run the [=SFrame initialization algorithm=] with |this| and |options|.
289
+
290
+
The <dfn constructor for="SFrameEncrypterStream" lt="SFrameEncrypterStream(options)"><code>new SFrameEncrypterStream(<var>options</var>)</code></dfn> constructor steps are:
291
+
1. Let |options| be the method's first argument.
292
+
1. Run the [=SFrame initialization algorithm=] with |this| and |options|.
293
+
1. Set |this|.`[[role]]` to 'encrypt'.
294
+
295
+
The <dfn constructor for="SFrameDecrypterStream" lt="SFrameDecrypterStream(options)"><code>new SFrameDecrypterStream(<var>options</var>)</code></dfn> constructor steps are:
296
+
1. Let |options| be the method's first argument.
297
+
1. Run the [=SFrame initialization algorithm=] with |this| and |options|.
298
+
1. Set |this|.`[[role]]` to 'decrypt'.
299
+
300
+
## Algorithms ## {#sframe-algorithms}
301
+
302
+
The <dfn>SFrame initialization algorithm</dfn>, given |this| and |options|, runs these steps:
303
+
1. Let |transformAlgorithm| be an algorithm which takes a |frame| as input and runs the [=SFrame transform algorithm=] with |this| and |frame|.
277
304
1. Set |this|.`[[transform]]` to a new {{TransformStream}}.
278
305
1. <a dfn for="ReadableStream">Set up</a>[=this=].`[[transform]]` with [=TransformStream/set up/transformAlgorithm=] set to |transformAlgorithm|.
279
-
1. Let |options| be the method's first argument.
280
-
1. Set |this|.`[[role]]` to |options|["{{SFrameTransformOptions/role}}"].
281
306
1. Set |this|.`[[cipherSuite]]` to |options|["{{SFrameTransformOptions/cipherSuite}}"].
282
307
1. Set |this|.`[[readable]]` to |this|.`[[transform]]`.`[[readable]]`.
283
308
1. Set |this|.`[[writable]]` to |this|.`[[transform]]`.`[[writable]]`.
284
309
285
-
## Algorithm ## {#sframe-transform-algorithm}
286
-
287
-
The SFrame transform algorithm, given |sframe| as a SFrameTransform object and |frame|, runs these steps:
288
-
1. Let |role| be |sframe|.`[[role]]`.
289
-
1. If |frame|.`[[owner]]` is a {{RTCRtpSender}}, set |role| to 'encrypt'.
290
-
1. If |frame|.`[[owner]]` is a {{RTCRtpReceiver}}, set |role| to 'decrypt'.
310
+
The <dfn>SFrame transform algorithm</dfn>, given |this| and |frame|, runs these steps:
311
+
1. Let |role| be |this|.`[[role]]`.
312
+
1. If |this|.`[[owner]]` is an {{RTCRtpSender}}, set |role| to 'encrypt'.
313
+
1. If |this|.`[[owner]]` is an {{RTCRtpReceiver}}, set |role| to 'decrypt'.
291
314
1. Let |data| be undefined.
292
315
1. If |frame| is a {{BufferSource}}, set |data| to |frame|.
293
316
1. If |frame| is a {{RTCEncodedAudioFrame}}, set |data| to |frame|.{{RTCEncodedAudioFrame/data}}
294
317
1. If |frame| is a {{RTCEncodedVideoFrame}}, set |data| to |frame|.{{RTCEncodedVideoFrame/data}}
295
318
1. If |data| is undefined, abort these steps.
296
-
1. Let |buffer| be the result of running the SFrame algorithm with |data|, |sframe|.`[[cipherSuite]]`, and |role| as parameters. This algorithm is defined by [[RFC9605]] and returns an {{ArrayBuffer}}.
319
+
1. Let |buffer| be the result of running the SFrame algorithm with |data|, |this|.`[[cipherSuite]]`, and |role| as parameters. This algorithm is defined by [[RFC9605]] and returns an {{ArrayBuffer}}.
297
320
1. If the SFrame algorithm exits abruptly with an error, [=queue a task=] to run the following sub steps:
298
-
1. If the processing fails on decryption side due to |data| not following the SFrame format, [=fire an event=] named {{SFrameTransform/onerror|error}} at |sframe|,
321
+
1. If the processing fails on decryption side due to |data| not following the SFrame format, [=fire an event=] named {{SFrameTransform/onerror|error}} at |this|,
299
322
using the {{SFrameTransformErrorEvent}} interface with its {{SFrameTransformErrorEvent/errorType}} attribute set to {{SFrameTransformErrorEventType/syntax}}
300
323
and its {{SFrameTransformErrorEvent/frame}} attribute set to |frame|.
301
-
1. If the processing fails on decryption side due to the key identifier parsed in |data| being unknown, [=fire an event=] named {{SFrameTransform/onerror|error}} at |sframe|,
324
+
1. If the processing fails on decryption side due to the key identifier parsed in |data| being unknown, [=fire an event=] named {{SFrameTransform/onerror|error}} at |this|,
302
325
using the {{SFrameTransformErrorEvent}} interface with its {{SFrameTransformErrorEvent/errorType}} attribute set to {{SFrameTransformErrorEventType/keyID}},
303
326
its {{SFrameTransformErrorEvent/frame}} attribute set to |frame| and its {{SFrameTransformErrorEvent/keyID}} attribute set to the keyID value parsed in the SFrame header.
304
-
1. If the processing fails on decryption side due to validation of the authentication tag, [=fire an event=] named {{SFrameTransform/onerror|error}} at |sframe|,
327
+
1. If the processing fails on decryption side due to validation of the authentication tag, [=fire an event=] named {{SFrameTransform/onerror|error}} at |this|,
305
328
using the {{SFrameTransformErrorEvent}} interface with its {{SFrameTransformErrorEvent/errorType}} attribute set to {{SFrameTransformErrorEventType/authentication}}
306
329
and its {{SFrameTransformErrorEvent/frame}} attribute set to |frame|.
307
330
1. Abort these steps.
308
331
1. If |frame| is a {{BufferSource}}, set |frame| to |buffer|.
309
332
1. If |frame| is a {{RTCEncodedAudioFrame}}, set |frame|.{{RTCEncodedAudioFrame/data}} to |buffer|.
310
333
1. If |frame| is a {{RTCEncodedVideoFrame}}, set |frame|.{{RTCEncodedVideoFrame/data}} to |buffer|.
311
-
1. [=ReadableStream/Enqueue=] |frame| in |sframe|.`[[transform]]`.
334
+
1. [=ReadableStream/Enqueue=] |frame| in |this|.`[[transform]]`.
312
335
313
336
## Methods ## {#sframe-transform-methods}
314
337
The <dfn method for="SFrameTransform">setEncryptionKey(|key|, |keyID|)</dfn> method steps are:
0 commit comments