diff --git a/index.bs b/index.bs index c2c666c..9499026 100644 --- a/index.bs +++ b/index.bs @@ -81,15 +81,16 @@ It uses an additional API on {{RTCRtpSender}} and {{RTCRtpReceiver}} to insert the processing into the pipeline.
-typedef (SFrameTransform or RTCRtpScriptTransform) RTCRtpTransform;
+typedef (SFrameSenderTransform or RTCRtpScriptTransform) RTCRtpSenderTransform;
+typedef (SFrameReceiverTransform or RTCRtpScriptTransform) RTCRtpReceiverTransform;
// New methods for RTCRtpSender and RTCRtpReceiver
partial interface RTCRtpSender {
- attribute RTCRtpTransform? transform;
+ attribute RTCRtpSenderTransform? transform;
};
partial interface RTCRtpReceiver {
- attribute RTCRtpTransform? transform;
+ attribute RTCRtpReceiverTransform? transform;
};
@@ -203,7 +204,7 @@ There is no guarantee on which frame will happen the switch from the previous tr
If a web application sets the transform synchronously at creation of the {{RTCRtpSender}} (for instance when calling addTrack), the transform will receive the first frame generated by the {{RTCRtpSender}}'s encoder.
Similarly, if a web application sets the transform synchronously at creation of the {{RTCRtpReceiver}} (for instance when calling addTrack, or at track event handler), the transform will receive the first full frame generated by the {{RTCRtpReceiver}}'s packetizer.
-# SFrameTransform # {#sframe}
+# SFrame transforms # {#sframe}
The APIs presented in this section allow applications to process SFrame data using specific cipher suites defined in [[RFC9605]].
@@ -226,30 +227,42 @@ dictionary SFrameTransformOptions {
typedef [EnforceRange] unsigned long long SmallCryptoKeyID;
typedef (SmallCryptoKeyID or bigint) CryptoKeyID;
-interface mixin SFrameKeyManagement {
+interface mixin SFrameEncrypterManagement {
Promise
@@ -1087,7 +1130,7 @@ The generate key frame algorithm, given |promise|, |frame
For any [=encoder=] associated with an {{RTCRtpScriptTransformer}} |transformer|, the user agent MUST run the following steps just before any |frame| is [=ReadableStream/enqueued=] into |transformer|.{{[[readable]]}}:
1. Let |encoder| be |transformer|.{{[[frameSource]]}}.
1. If |encoder|.`[[pendingKeyFrameTasks]]` is undefined, abort these steps.
-1. If |frame| is not a video {{RTCEncodedVideoFrameType/"key"}} frame, abort these steps.
+1. If |frame| is not a video {{EncodedVideoChunkType/"key"}} frame, abort these steps.
1. For each |task| in |encoder|.`[[pendingKeyFrameTasks]]`, run the following steps:
1. If |frame| was generated for a layer [=list/contained=] in |task|.`[[layers]]`,
then run the following steps:
new SFrameTransform(options) constructor steps are:
+The new SFrameSenderTransform(options) constructor steps are:
+1. Let |options| be the method's first argument.
+1. Run the [=SFrame initialization algorithm=] with |this| and |options|.
+1. Set |this|.`[[role]]` to 'encrypt'.
+
+The new SFrameReceiverTransform(options) constructor steps are:
1. Let |options| be the method's first argument.
1. Run the [=SFrame initialization algorithm=] with |this| and |options|.
+1. Set |this|.`[[role]]` to 'decrypt'.
The new SFrameEncrypterStream(options) constructor steps are:
1. Let |options| be the method's first argument.
@@ -324,14 +343,38 @@ The SFrame transform algorithm, given |this| and |frame|, runs these
1. [=ReadableStream/Enqueue=] |frame| in |this|.`[[transform]]`.
## Methods ## {#sframe-transform-methods}
-The setEncryptionKey(|key|, |keyID|) method steps are:
+The setEncryptionKey(|key|, |keyID|) method steps are:
1. Let |promise| be [=a new promise=].
-2. If |keyID| is a {{bigint}} which cannot be represented as a integer between 0 and 264-1 inclusive, [=reject=] |promise| with a {{RangeError}} exception.
-3. Otherwise, [=in parallel=], run the following steps:
- 1. Set |key| with its optional |keyID| as key material to use for the SFrame transform algorithm, as defined by [[RFC9605]].
- 2. If setting the key material fails, [=reject=] |promise| with an {{InvalidModificationError}} exception and abort these steps.
- 3. [=Resolve=] |promise| with undefined.
-4. Return |promise|.
+1. If |keyId| is undefined, run the following steps:
+ 1. Let |currentKeyId| be |this|.`[[currentKeyId]]` if not undefined or 0 otherwise.
+ 1. If |currentKeyId| is greater or equal to 264-1, [=reject=] |promise| with a {{RangeError}} exception and abort these steps.
+ 1. Set |keyId| to |currentKeyId| incremented by 1.
+1. If |keyID| is a {{bigint}} which cannot be represented as a integer between 0 and 264-1 inclusive, [=reject=] |promise| with a {{RangeError}} exception and abort these steps.
+1. Set |this|.`[[currentKeyId]]` to |keyId|.
+1. [=In parallel=], run the following steps:
+ 1. Set the SFrame transform encryption algorithm's key material to |key| and |keyID|, as defined by [[RFC9605]].
+ 1. If setting the key material fails, [=queue a task=] to [=reject=] |promise| with an {{InvalidModificationError}} exception and abort these steps.
+ 1. [=Queue a task=] to [=resolve=] |promise| with undefined.
+1. Return |promise|.
+
+The addDecryptionKey(|key|, |keyID|) method steps are:
+1. Let |promise| be [=a new promise=].
+1. If |keyID| is a {{bigint}} which cannot be represented as a integer between 0 and 264-1 inclusive, [=reject=] |promise| with a {{RangeError}} exception, and abort these steps..
+1. [=In parallel=], run the following steps:
+ 1. Let |keyStore| be the key store used for the SFrame transform algorithm, as defined by [[RFC9605]].
+ 1. [=map/set|Set=] |keyStore|[|keyId|] to |keyValue|.
+ 1. If setting the key material fails, [=queue a task=] to [=reject=] |promise| with an {{InvalidModificationError}} exception and abort these steps.
+ 1. [=Resolve=] |promise| with undefined.
+1. Return |promise|.
+
+The removeDecryptionKey(|key|, |keyID|) method steps are:
+1. Let |promise| be [=a new promise=].
+1. If |keyID| is a {{bigint}} which cannot be represented as a integer between 0 and 264-1 inclusive, [=reject=] |promise| with a {{RangeError}} exception, and abort these steps.
+1. [=In parallel=], run the following steps:
+ 1. Let |keyStore| be the key store used for the SFrame transform algorithm, as defined by [[RFC9605]].
+ 1. Remove the entry of |keyStore| at |keyId| if it exits.
+ 1. [=Resolve=] |promise| with undefined.
+1. Return |promise|.
# Script Transform # {#scriptTransform}
@@ -528,7 +571,7 @@ interface RTCEncodedVideoFrame {
### Members ### {#RTCEncodedVideoFrame-members}