Skip to content

Commit c493da4

Browse files
committed
Add SFrame packetization handling for SFrameTransform
Introduce RTCRtpScriptTransformType with "sframe" value.
1 parent 45066af commit c493da4

File tree

1 file changed

+44
-7
lines changed

1 file changed

+44
-7
lines changed

index.bs

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,22 @@ spec:webidl; type:dfn; text:resolve
4848
"href": "https://datatracker.ietf.org/doc/draft-ietf-avtcore-abs-capture-time/",
4949
"title": "RTP Header Extension for Absolute Capture Time",
5050
"publisher": "IETF"
51+
},
52+
"RTP-SFRAME-PAYLOAD": {
53+
"href": "https://datatracker.ietf.org/doc/draft-ietf-avtcore-rtp-sframe/",
54+
"title": "RTP Payload Format for SFrame",
55+
"publisher": "IETF"
5156
}
5257
}
5358
</pre>
5459
<pre class=link-defaults>
5560
spec:streams; type:interface; text:ReadableStream
5661
spec:infra; type:dfn; text:list
5762
</pre>
63+
<pre class=anchors>
64+
url: https://w3c.github.io/webrtc-pc/#dfn-update-the-negotiation-needed-flag; text: update the negotiation-needed flag; type: dfn; spec: WEBRTC
65+
url: https://w3c.github.io/webrtc-pc/#dfn-check-if-negotiation-is-needed; text: check the negotiation-needed flag; type: dfn; spec: WEBRTC
66+
</pre>
5867

5968
# Introduction # {#introduction}
6069

@@ -102,6 +111,14 @@ argument, ensure that the codec is disabled and produces no output.
102111

103112
### Stream creation ### {#stream-creation}
104113

114+
At construction of each {{RTCRtpTransceiver}}, run the following steps:
115+
1. If [=this=] is associated with a media description, initialize [=this=].`[[useSFrame]]` from the media description. If [=this=].`[[useSFrame]]` is true, enable SFrame RTP packetization for [=this=].
116+
1. Otherwise, [=queue a task=] to run the following steps:
117+
1. If [=this=].`[[useSFrame]]` is undefined, set [=this=].`[[useSFrame]]` to false.
118+
119+
The [=check the negotiation-needed flag=] algorithm is updated by adding the below step after step 5.4:
120+
1. If |transceiver|.`[[useSFrame]]` is true and the media description does not describe the use of SFrame RTP packetization as defined in [[RTP-SFRAME-PAYLOAD]], return true.
121+
105122
At construction of each {{RTCRtpSender}} or {{RTCRtpReceiver}}, run the following steps:
106123
1. Initialize [=this=].`[[transform]]` to null.
107124
1. Initialize [=this=].`[[readable]]` to a new {{ReadableStream}}.
@@ -185,6 +202,15 @@ The <dfn attribute for="RTCRtpSender,RTCRtpReceiver">transform</dfn> getter step
185202

186203
The `transform` setter steps are:
187204
1. Let |transform| be the argument to the setter.
205+
1. Let |transceiver| be the {{RTCRtpTransceiver}} associated to [=this=].
206+
1. If |transform|.`[[useSFrame]]` is true, run the following steps:
207+
1. If |transceiver|.`[[useSFrame]]` is false, throw a {{InvalidModificationError}} and abort these steps.
208+
1. Otherwise, if |transceiver|.`[[useSFrame]]` is undefined, run the following steps:
209+
1. Set |transceiver|.`[[useSFrame]]` to true.
210+
1. Enable SFrame RTP packetization for |transceiver| and [=update the negotiation-needed flag=] for [=this=]'s connection.
211+
1. Otherwise, run the following steps:
212+
1. If |transceiver|.`[[useSFrame]]` is true, throw a {{InvalidModificationError}} and abort these steps.
213+
1. Set |transceiver|.`[[useSFrame]]` to false.
188214
1. Let |checkedTransform| set to |transform| if it is not null or to an [=identity transform stream=] otherwise.
189215
1. If |checkedTransform|.`[[owner]]` is not null, throw a {{InvalidStateError}} and abort these steps.
190216
1. Let |reader| be the result of [=ReadableStream/getting a reader=] for |checkedTransform|.`[[readable]]`.
@@ -286,6 +312,7 @@ dictionary SFrameTransformErrorEventInit : EventInit {
286312

287313
The <dfn constructor for="SFrameTransform" lt="SFrameTransform(options)"><code>new SFrameTransform(<var>options</var>)</code></dfn> constructor steps are:
288314
1. Let |options| be the method's first argument.
315+
1. Set |this|.`[[useSFrame]]` to true.
289316
1. Run the [=SFrame initialization algorithm=] with |this| and |options|.
290317

291318
The <dfn constructor for="SFrameEncrypterStream" lt="SFrameEncrypterStream(options)"><code>new SFrameEncrypterStream(<var>options</var>)</code></dfn> constructor steps are:
@@ -930,6 +957,14 @@ interface RTCRtpScriptTransformer : EventTarget {
930957
readonly attribute any options;
931958
};
932959

960+
enum RTCRtpScriptTransformType {
961+
"sframe"
962+
};
963+
964+
dictionary PartialTransformOptions {
965+
RTCRtpScriptTransformType type;
966+
};
967+
933968
[Exposed=Window]
934969
interface RTCRtpScriptTransform {
935970
constructor(Worker worker, optional any options, optional sequence&lt;object&gt; transfer);
@@ -945,14 +980,16 @@ interface KeyFrameRequestEvent : Event {
945980
## Operations ## {#RTCRtpScriptTransform-operations}
946981

947982
The <dfn constructor for="RTCRtpScriptTransform" lt="RTCRtpScriptTransform(worker, options)"><code>new RTCRtpScriptTransform(|worker|, |options|, |transfer|)</code></dfn> constructor steps are:
983+
1. Let |typedOptions| be |options|, [=converted to an IDL value=] of type {{PartialTransformOptions}}.
984+
1. If |typedOptions|.{{PartialTransformOptions/type}} is equal to {{RTCRtpScriptTransformType/"sframe"}}, set |this|.`[[useSFrame]]` to true.
948985
1. Set |t1| to an [=identity transform stream=].
949-
2. Set |t2| to an [=identity transform stream=].
950-
3. Set |this|.`[[writable]]` to |t1|.`[[writable]]`.
951-
4. Set |this|.`[[readable]]` to |t2|.`[[readable]]`.
952-
5. Let |serializedOptions| be the result of [$StructuredSerializeWithTransfer$](|options|, |transfer|).
953-
6. Let |serializedReadable| be the result of [$StructuredSerializeWithTransfer$](|t1|.`[[readable]]`, « |t1|.`[[readable]]` »).
954-
7. Let |serializedWritable| be the result of [$StructuredSerializeWithTransfer$](|t2|.`[[writable]]`, « |t2|.`[[writable]]` »).
955-
8. [=Queue a task=] on the DOM manipulation [=task source=] |worker|'s global scope to run the following steps:
986+
1. Set |t2| to an [=identity transform stream=].
987+
1. Set |this|.`[[writable]]` to |t1|.`[[writable]]`.
988+
1. Set |this|.`[[readable]]` to |t2|.`[[readable]]`.
989+
1. Let |serializedOptions| be the result of [$StructuredSerializeWithTransfer$](|options|, |transfer|).
990+
1. Let |serializedReadable| be the result of [$StructuredSerializeWithTransfer$](|t1|.`[[readable]]`, « |t1|.`[[readable]]` »).
991+
1. Let |serializedWritable| be the result of [$StructuredSerializeWithTransfer$](|t2|.`[[writable]]`, « |t2|.`[[writable]]` »).
992+
1. [=Queue a task=] on the DOM manipulation [=task source=] |worker|'s global scope to run the following steps:
956993
1. Let |transformerOptions| be the result of [$StructuredDeserializeWithTransfer$](|serializedOptions|, the current Realm).
957994
2. Let |readable| be the result of [$StructuredDeserializeWithTransfer$](|serializedReadable|, the current Realm).
958995
3. Let |writable| be the result of [$StructuredDeserializeWithTransfer$](|serializedWritable|, the current Realm).

0 commit comments

Comments
 (0)