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
Copy file name to clipboardExpand all lines: index.bs
+99-55Lines changed: 99 additions & 55 deletions
Original file line number
Diff line number
Diff line change
@@ -63,54 +63,6 @@ an additional API on {{RTCRtpSender}} and {{RTCRtpReceiver}} to
63
63
insert the processing into the pipeline.
64
64
65
65
<pre class="idl">
66
-
// New dictionary.
67
-
dictionary RTCInsertableStreams {
68
-
ReadableStream readable;
69
-
WritableStream writable;
70
-
};
71
-
72
-
// New enum for video frame types. Will eventually re-use the equivalent defined
73
-
// by WebCodecs.
74
-
enum RTCEncodedVideoFrameType {
75
-
"empty",
76
-
"key",
77
-
"delta",
78
-
};
79
-
80
-
dictionary RTCEncodedVideoFrameMetadata {
81
-
long long frameId;
82
-
sequence<long long> dependencies;
83
-
unsigned short width;
84
-
unsigned short height;
85
-
long spatialIndex;
86
-
long temporalIndex;
87
-
long synchronizationSource;
88
-
sequence<long> contributingSources;
89
-
};
90
-
91
-
// New interfaces to define encoded video and audio frames. Will eventually
92
-
// re-use or extend the equivalent defined in WebCodecs.
93
-
[Exposed=Window]
94
-
interface RTCEncodedVideoFrame {
95
-
readonly attribute RTCEncodedVideoFrameType type;
96
-
readonly attribute unsigned long long timestamp;
97
-
attribute ArrayBuffer data;
98
-
RTCEncodedVideoFrameMetadata getMetadata();
99
-
};
100
-
101
-
dictionary RTCEncodedAudioFrameMetadata {
102
-
long synchronizationSource;
103
-
sequence<long> contributingSources;
104
-
};
105
-
106
-
[Exposed=Window]
107
-
interface RTCEncodedAudioFrame {
108
-
readonly attribute unsigned long long timestamp;
109
-
attribute ArrayBuffer data;
110
-
RTCEncodedAudioFrameMetadata getMetadata();
111
-
};
112
-
113
-
114
66
// New fields in RTCConfiguration
115
67
partial dictionary RTCConfiguration {
116
68
boolean encodedInsertableStreams = false;
@@ -142,13 +94,13 @@ argument, ensure that the codec is disabled and produces no output.
142
94
At construction of each {{RTCRtpSender}} or {{RTCRtpReceiver}}, run the following steps:
143
95
1. Initialize [=this=].`[[Streams]]` to null.
144
96
2. Initialize [=this=].`[[transform]]` to null.
145
-
3. Initialize [=this=].`[[readable]]` to the result of <a dfn for="ReadableStream">creating</a> a {{ReadableStream}}. `[[readable]]` is provided frames using the [=readEncodedData=] algorithm given |this| as parameter.
97
+
3. Initialize [=this=].`[[readable]]` to the result of <a dfn for="ReadableStream">creating</a> a {{ReadableStream}}. [=this=].`[[readable]]` is provided frames using the [=readEncodedData=] algorithm given |this| as parameter.
146
98
4. Set [=this=].`[[readable]]`.`[[owner]]` to |this|.
147
99
5. Initialize [=this=].`[[writable]]` to the result of [=WritableStream/creating=] a {{WritableStream}}, its [=WritableStream/create/writeAlgorithm=] set to [=writeEncodedData=] given |this| as parameter.
148
100
6. Set [=this=].`[[writable]]`.`[[owner]]` to |this|.
149
101
7. Initialize [=this=].`[[pipeToController]]` to null.
150
102
8. Initialize [=this=].`[[lastReceivedFrameTimestamp]]` to zero.
151
-
9. If the {{RTCPeerConnection}}'s configuration does not have {{RTCConfiguration/encodedInsertableStreams}} set to "true", queue a task to run the following steps:
103
+
9. If the {{RTCPeerConnection}}'s configuration does not have {{RTCConfiguration/encodedInsertableStreams}} set to "true", [=queue a task=] to run the following steps:
152
104
1. If [=this=].`[[pipeToController]]` is not null, abort these steps.
153
105
2. Set [=this=].`[[pipeToController]]` to a new {{AbortController}}.
154
106
<!-- FIXME: Use pipeTo algorithm when available. -->
@@ -172,7 +124,7 @@ The <dfn>readEncodedData</dfn> algorithm is given a |rtcObject| as parameter. It
172
124
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}}.
173
125
2. Let |frame| be the newly produced frame.
174
126
3. Set |frame|.`[[owner]]` to |rtcObject|.
175
-
4. [=ReadableStream/enqueue=] |frame| in |rtcObject|.`[[readable]]`.
127
+
4. [=ReadableStream/Enqueue=] |frame| in |rtcObject|.`[[readable]]`.
176
128
177
129
The <dfn>writeEncodedData</dfn> algorithm is given a |rtcObject| as parameter and a |frame| as input. It is defined by running the following steps:
178
130
1. If |frame|.`[[owner]]` is not equal to |rtcObject|, abort these steps and return [=a promise resolved with=] undefined. A processor cannot create frames, or move frames between streams.
@@ -246,7 +198,7 @@ The <dfn constructor for="SFrameTransform" lt="SFrameTransform(options)"><code>n
246
198
5. Set |this|.`[[readable]]` to |this|.`[[transform]]`.`[[readable]]`.
247
199
6. Set |this|.`[[writable]]` to |this|.`[[transform]]`.`[[writable]]`.
3. Set |this|.`[[writable]]` to |t1|.`[[writable]]`.
290
305
4. Set |this|.`[[readable]]` to |t2|.`[[readable]]`.
291
-
5. FIXME: transfer |t1|.`[[readable]]` and |t2|.`[[writable]]` to the dedicated worker.
292
-
6. FIXME: Create counterpart of |this| in dedicated worker, for instance expose transfered |t1|.`[[readable]]` and |t2|.`[[writable]]`.
306
+
5. Let |serializedOptions| be the result of [$StructuredSerialize$](|object|).
307
+
6. Let |serializedReadable| be the result of [$StructuredSerializeWithTransfer$](|t1|.`[[readable]]`, « |t1|.`[[readable]]` »).
308
+
7. Let |serializedWritable| be the result of [$StructuredSerializeWithTransfer$](|t2|.`[[writable]]`, « |t2|.`[[writable]]` »).
309
+
8. [=Queue a task=] on the DOM manipulation [=task source=] |worker|'s global scope to run the following steps:
310
+
1. Let |transformerOptions| be the result of [$StructuredDeserialize$](|serializedOptions|, the current Realm).
311
+
2. Let |readable| be the result of [$StructuredDeserialize$](|serializedReadable|, the current Realm).
312
+
3. Let |writable| be the result of [$StructuredDeserialize$](|serializedWritable|, the current Realm).
313
+
4. Let |transformer| be a new {{RTCRtpScriptTransformer}}.
314
+
5. Set |transformer|.`[[options]]` to |transformerOptions|.
315
+
6. Set |transformer|.`[[readable]]` to |readable|.
316
+
7. Set |transformer|.`[[writable]]` to |writable|.
317
+
8. Let |event| be the result of [=creating an event=] with {{RTCTransformEvent}}.
318
+
9. Set |event|.type attribute to "rtctransform".
319
+
10. Set |event|.transformer to |transformer|.
320
+
11. Dispatch |event| on |worker|’s global scope.
321
+
322
+
// FIXME: Describe error handling (worker closing flag true at RTCRtpScriptTransform creation time. And worker being terminated while transform is processing data).
0 commit comments