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
This allows manipulation of encoded frames in the media pipeline
97
+
between the processing steps of an {{RTCRtpSender}}'s underlying
98
+
<dfn>encoder</dfn> and <dfn ignore=''>packetizer</dfn>, and/or
99
+
between an {{RTCRtpReceiver}}'s underlying <dfn>depacketizer</dfn>
100
+
and <dfn ignore=''>decoder</dfn>.
101
+
96
102
## Extension operation ## {#operation}
97
103
98
104
At the time when a codec is initialized as part of the encoder, and the
99
105
corresponding flag is set in the {{RTCPeerConnection}}'s {{RTCConfiguration}}
100
106
argument, ensure that the codec is disabled and produces no output.
101
107
102
-
103
-
### Stream creation ### {#stream-creation}
104
-
105
108
At construction of each {{RTCRtpSender}} or {{RTCRtpReceiver}}, run the following steps:
106
109
1. Initialize [=this=].`[[transform]]` to null.
107
-
1. Initialize [=this=].`[[readable]]` to a new {{ReadableStream}}.
108
-
1. <a dfn for="ReadableStream">Set up</a>[=this=].`[[readable]]`. [=this=].`[[readable]]` is provided frames using the [$readEncodedData$] algorithm given |this| as parameter.
109
-
1. Initialize [=this=].`[[writable]]` to a new {{WritableStream}}.
110
-
1. <a dfn for="WritableStream">Set up</a>[=this=].`[[writable]]` with its [=WritableStream/set up/writeAlgorithm=] set to [$writeEncodedData$] given |this| as parameter and its [=WritableStream/set up/highWaterMark=] set to <code>Infinity</code>.
111
-
<p class="note">highWaterMark is set to Infinity to explicitly disable backpressure.</p>
112
110
1. Initialize [=this=].`[[pipeToController]]` to null.
113
111
1. Initialize [=this=].`[[lastReceivedFrameCounter]]` to <code>0</code>.
114
112
1. Initialize [=this=].`[[lastEnqueuedFrameCounter]]` to <code>0</code>.
115
113
1. [=Queue a task=] to run the following steps:
116
114
1. If [=this=].`[[pipeToController]]` is not null, abort these steps.
117
115
2. Set [=this=].`[[pipeToController]]` to a new {{AbortController}}.
118
-
<!-- FIXME: Use pipeTo algorithm when available. -->
119
-
3. Call <a href="https://streams.spec.whatwg.org/#readable-stream-pipe-to">pipeTo</a> with [=this=].`[[readable]]`, [=this=].`[[writable]]`, preventClose equal to true, preventAbort equal to true, preventCancel equal to true and [=this=].`[[pipeToController]]`'s [=AbortController/signal=].
116
+
<!-- FIXME: Fix aborting. -->
117
+
<p class="note">TODO: Specify details of how
118
+
[=this=].`[[pipeToController]]` aborts streaming in the worker.</p>
119
+
120
+
### Stream processing ### {#stream-processing}
120
121
121
122
<p class=note>
122
123
Streams backpressure can optimize throughput while limiting processing and memory consumption by pausing data production as early as possible in a data pipeline.
@@ -127,8 +128,6 @@ The User Agent is responsible for doing these adaptations, especially since it c
127
128
For those reasons, streams backpressure is disabled in WebRTC encoded transforms.
128
129
</p>
129
130
130
-
### Stream processing ### {#stream-processing}
131
-
132
131
The <dfn abstract-op>readEncodedData</dfn> algorithm is given a |rtcObject| as parameter. It is defined by running the following steps:
133
132
1. Wait for a frame to be produced by |rtcObject|'s encoder if it is a {{RTCRtpSender}} or |rtcObject|'s packetizer if it is a {{RTCRtpReceiver}}.
134
133
1. Increment |rtcObject|.`[[lastEnqueuedFrameCounter]]` by <code>1</code>.
@@ -345,7 +344,7 @@ The <dfn method for="SFrameTransform">setEncryptionKey(|key|, |keyID|)</dfn> met
345
344
4. Return |promise|.
346
345
347
346
348
-
# RTCRtpScriptTransform # {#scriptTransform}
347
+
# Script Transform # {#scriptTransform}
349
348
350
349
In this section, the capture system refers to the system where media is sourced from and the sender system
351
350
refers to the system that is sending RTP and RTCP packets to the receiver system where {{RTCEncodedFrameMetadata}} data is populated.
@@ -906,65 +905,30 @@ Their [=deserialization steps=], given |serialized|, |value| and |realm|, are:
906
905
1. Set |value|'s metadata to the platform object representation of |serialized|.`[[metadata]]`
907
906
1. Set |value|.`[[data]]` to the [=sub-deserialization=] of |serialized|.`[[data]]`.
3. Set |this|.`[[writable]]` to |t1|.`[[writable]]`.
951
-
4. Set |this|.`[[readable]]` to |t2|.`[[readable]]`.
952
920
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
921
8. [=Queue a task=] on the DOM manipulation [=task source=] |worker|'s global scope to run the following steps:
956
922
1. Let |transformerOptions| be the result of [$StructuredDeserializeWithTransfer$](|serializedOptions|, the current Realm).
957
-
2. Let |readable| be the result of [$StructuredDeserializeWithTransfer$](|serializedReadable|, the current Realm).
958
-
3. Let |writable| be the result of [$StructuredDeserializeWithTransfer$](|serializedWritable|, the current Realm).
959
-
4. Let |transformer| be a new {{RTCRtpScriptTransformer}}.
960
-
5. Set |transformer|.`[[options]]` to |transformerOptions|.
961
-
6. Set |transformer|.`[[readable]]` to |readable|.
962
-
7. Set |transformer|.`[[writable]]` to |writable|.
923
+
4. Let |transformer| be the result of [=RTCRtpScriptTransformer/creating=] a
924
+
{{RTCRtpScriptTransformer}} with |transformerOptions|.
963
925
8. [=Fire an event=] named <dfn event for="DedicatedWorkerGlobalScope">rtctransform</dfn> using {{RTCTransformEvent}} with {{RTCTransformEvent/transformer}} set to |transformer| on |worker|’s global scope.
964
926
965
927
// FIXME: Describe error handling (worker closing flag true at RTCRtpScriptTransform creation time. And worker being terminated while transform is processing data).
966
928
967
-
Each RTCRtpScriptTransform has the following set of [$association steps$], given |rtcObject|:
0 commit comments