Skip to content

Commit 9745de0

Browse files
authored
Explicitly throw InvalidStateError when trying to reuse a transform (#251)
1 parent 8c38a88 commit 9745de0

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

index.bs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -177,26 +177,31 @@ As [$writeEncodedData$] ensures that the transform cannot reorder frames, this w
177177

178178
## Extension attribute ## {#attribute}
179179

180-
A RTCRtpTransform has two private slots called `[[readable]]` and `[[writable]]`.
180+
A RTCRtpTransform has private slots:
181+
* `[[readable]]` of type {{ReadableStream}}.
182+
* `[[writable]]` of type {{WritableStream}}.
183+
* `[[owner]]` of type {{RTCRtpSender}} or {{RTCRtpReceiver}}, initialized to null.
181184

182185
Each RTCRtpTransform has an <dfn abstract-op for=RTCRtpTransform>association steps</dfn> set, which is empty by default.
183186

184187
The <dfn attribute for="RTCRtpSender,RTCRtpReceiver">transform</dfn> getter steps are:
185188
1. Return [=this=].`[[transform]]`.
186189

187190
The `transform` setter steps are:
188-
2. Let |transform| be the argument to the setter.
189-
3. Let |checkedTransform| set to |transform| if it is not null or to an [=identity transform stream=] otherwise.
190-
3. Let |reader| be the result of [=ReadableStream/getting a reader=] for |checkedTransform|.`[[readable]]`.
191-
4. Let |writer| be the result of [=WritableStream/getting a writer=] for |checkedTransform|.`[[writable]]`.
192-
5. Initialize |newPipeToController| to a new {{AbortController}}.
193-
6. If [=this=].`[[pipeToController]]` is not null, run the following steps:
191+
1. Let |transform| be the argument to the setter.
192+
1. Let |checkedTransform| set to |transform| if it is not null or to an [=identity transform stream=] otherwise.
193+
1. If |checkedTransform|.`[[owner]]` is not null, throw a {{InvalidStateError}} and abort these steps.
194+
1. Let |reader| be the result of [=ReadableStream/getting a reader=] for |checkedTransform|.`[[readable]]`.
195+
1. Let |writer| be the result of [=WritableStream/getting a writer=] for |checkedTransform|.`[[writable]]`.
196+
1. Set |checkedTransform|.`[[owner]]` to [=this=].
197+
1. Initialize |newPipeToController| to a new {{AbortController}}.
198+
1. If [=this=].`[[pipeToController]]` is not null, run the following steps:
194199
1. [=AbortSignal/Add=] the [$chain transform algorithm$] to [=this=].`[[pipeToController]]`'s [=AbortController/signal=].
195200
2. [=AbortController/signal abort=] on [=this=].`[[pipeToController]]`.
196-
7. Else, run the [$chain transform algorithm$] steps.
197-
8. Set [=this=].`[[pipeToController]]` to |newPipeToController|.
198-
9. Set [=this=].`[[transform]]` to |transform|.
199-
10. Run the steps in the set of [$association steps$] of |transform| with [=this=].
201+
1. Else, run the [$chain transform algorithm$] steps.
202+
1. Set [=this=].`[[pipeToController]]` to |newPipeToController|.
203+
1. Set [=this=].`[[transform]]` to |transform|.
204+
1. Run the steps in the set of [$association steps$] of |transform| with [=this=].
200205

201206
The <dfn abstract-op>chain transform algorithm</dfn> steps are defined as:
202207
1. If |newPipeToController|'s [=AbortController/signal=] is [=AbortSignal/aborted=], abort these steps.

0 commit comments

Comments
 (0)