diff --git a/index.src.html b/index.src.html
index 41bbc23e..27ee83b2 100644
--- a/index.src.html
+++ b/index.src.html
@@ -218,15 +218,7 @@
Running a control
message means performing a sequence of steps specified by the method
-that enqueued the message. The steps of a control message may depend on
-injected state, supplied by the method that enqueued the message.
-
-Resetting the control message
- queue means performing these steps:
-1. For each [=control message=] in the [=control message queue=]:
- 1. If a control message's [=injected state=] includes a promise, reject
- that promise.
- 2. Remove the message from the queue.
+that enqueued the message.
The codec processing loop must run these steps:
1. While true:
@@ -279,6 +271,8 @@
: \[[decodeQueueSize]]
:: The number of pending decode requests. This number will decrease as the
underlying codec is ready to accept new input.
+: [[pending flush promises]]
+:: A list of unresolved promises returned by calls to {{AudioDecoder/flush()}}.
Constructors {#audiodecoder-constructors}
-----------------------------------------
@@ -385,7 +379,8 @@
2. Set {{AudioDecoder/[[key chunk required]]}} to `true`.
3. Let |promise| be a new Promise.
4. [=Queue a control message=] to flush the codec with |promise|.
- 5. Return |promise|.
+ 5. Append |promise| to {{AudioDecoder/[[pending flush promises]]}}.
+ 6. Return |promise|.
[=Running a control message=] to flush the codec means performing these steps
with |promise|.
@@ -396,7 +391,9 @@
3. If |decoded outputs| is not empty, queue a task on the [=control thread=]
event loop to run the [=Output AudioData=] algorithm with
|decoded outputs|.
- 4. Queue a task on the [=control thread=] event loop to resolve |promise|.
+ 4. Queue a task on the [=control thread=] event loop to run these steps:
+ 1. Remove |promise| from {{AudioDecoder/[[pending flush promises]]}}.
+ 2. Resolve |promise|.
reset()
@@ -405,7 +402,8 @@
[=control messages=] in the [=control message queue=], and all pending
callbacks.
- When invoked, run the [=Reset AudioDecoder=] algorithm.
+ When invoked, run the [=Reset AudioDecoder=] algorithm with an
+ {{AbortError}} {{DOMException}}.
close()
@@ -413,7 +411,8 @@
Immediately aborts all pending work and releases [=system resources=].
Close is final.
- When invoked, run the [=Close AudioDecoder=] algorithm.
+ When invoked, run the [=Close AudioDecoder=] algorithm with an
+ {{AbortError}} {{DOMException}}.
isConfigSupported(config)
@@ -467,25 +466,28 @@
{{AudioData/[[number of channels]]}} as determined by |output|.
3. Invoke {{AudioDecoder/[[output callback]]}} with |data|.
- Reset AudioDecoder
+ Reset AudioDecoder (with |exception|)
Run these steps:
1. If {{AudioDecoder/[[state]]}} is `"closed"`, throw an {{InvalidStateError}}.
2. Set {{AudioDecoder/[[state]]}} to `"unconfigured"`.
3. Signal {{AudioDecoder/[[codec implementation]]}} to cease producing
output for the previous configuration.
- 4. [=Reset the control message queue=].
+ 4. Remove all [=control messages=] from the [=control message queue=].
5. Set {{AudioDecoder/[[decodeQueueSize]]}} to zero.
+ 6. For each |promise| in {{AudioDecoder/[[pending flush promises]]}}:
+ 1. Reject |promise| with |exception|.
+ 2. Remove |promise| from {{AudioDecoder/[[pending flush promises]]}}.
- Close AudioDecoder (with error)
+ Close AudioDecoder (with |exception|)
Run these steps:
- 1. Run the [=Reset AudioDecoder=] algorithm.
+ 1. Run the [=Reset AudioDecoder=] algorithm with |exception|.
2. Set {{AudioDecoder/[[state]]}} to `"closed"`.
3. Clear {{AudioDecoder/[[codec implementation]]}} and release associated
[=system resources=].
- 4. If |error| is set, queue a task on the [=control thread=] event loop to
- invoke the {{AudioDecoder/[[error callback]]}} with |error|.
+ 4. If |exception| is not an {{AbortError}} {{DOMException}}, queue a task on
+ the [=control thread=] event loop to invoke the {{AudioDecoder/[[error callback]]}} with |exception|.
@@ -533,6 +535,9 @@
:: The current {{CodecState}} of this {{VideoDecoder}}.
: \[[decodeQueueSize]]
:: The number of pending decode requests. This number will decrease as the underlying codec is ready to accept new input.
+: [[pending flush promises]]
+:: A list of unresolved promises returned by calls to {{VideoDecoder/flush()}}.
+
Constructors {#videodecoder-constructors}
-----------------------------------------
@@ -647,7 +652,8 @@
2. Set {{VideoDecoder/[[key chunk required]]}} to `true`.
3. Let |promise| be a new Promise.
4. [=Queue a control message=] to flush the codec with |promise|.
- 5. Return |promise|.
+ 5. Append |promise| to {{VideoDecoder/[[pending flush promises]]}}.
+ 6. Return |promise|.
[=Running a control message=] to flush the codec means performing these steps
with |promise|.
@@ -658,7 +664,9 @@
3. If |decoded outputs| is not empty, queue a task on the [=control thread=]
event loop to run the [=Output VideoFrames=] algorithm with
|decoded outputs|.
- 4. Queue a task on the [=control thread=] event loop to resolve |promise|.
+ 4. Queue a task on the [=control thread=] event loop to run these steps:
+ 1. Remove |promise| from {{VideoDecoder/[[pending flush promises]]}}.
+ 2. Resolve |promise|.
reset()
@@ -667,7 +675,8 @@
[=control messages=] in the [=control message queue=], and all pending
callbacks.
- When invoked, run the [=Reset VideoDecoder=] algorithm.
+ When invoked, run the [=Reset VideoDecoder=] algorithm with an
+ {{AbortError}} {{DOMException}}.
close()
@@ -675,7 +684,8 @@
Immediately aborts all pending work and releases [=system resources=].
Close is final.
- When invoked, run the [=Close VideoDecoder=] algorithm.
+ When invoked, run the [=Close VideoDecoder=] algorithm with an
+ {{AbortError}} {{DOMException}}.
isConfigSupported(config)
@@ -727,25 +737,29 @@
and |displayAspectHeight|.
5. Invoke {{VideoDecoder/[[output callback]]}} with |frame|.
- Reset VideoDecoder
+ Reset VideoDecoder (with |exception|)
Run these steps:
1. If {{VideoDecoder/state}} is `"closed"`, throw an {{InvalidStateError}}.
2. Set {{VideoDecoder/state}} to `"unconfigured"`.
3. Signal {{VideoDecoder/[[codec implementation]]}} to cease producing
output for the previous configuration.
- 4. [=Reset the control message queue=].
+ 4. Remove all [=control messages=] from the [=control message queue=].
5. Set {{VideoDecoder/[[decodeQueueSize]]}} to zero.
+ 6. For each |promise| in {{VideoDecoder/[[pending flush promises]]}}:
+ 1. Reject |promise| with |exception|.
+ 2. Remove |promise| from {{VideoDecoder/[[pending flush promises]]}}.
- Close VideoDecoder (with |error|)
+ Close VideoDecoder (with |exception|)
Run these steps:
- 1. Run the [=Reset VideoDecoder=] algorithm.
+ 1. Run the [=Reset VideoDecoder=] algorithm with |exception|.
2. Set {{VideoDecoder/state}} to `"closed"`.
3. Clear {{VideoDecoder/[[codec implementation]]}} and release associated
[=system resources=].
- 4. If |error| is set, queue a task on the [=control thread=] event loop to
- invoke the {{VideoDecoder/[[error callback]]}} with |error|.
+ 4. If |exception| is not an {{AbortError}} {{DOMException}}, queue a task on
+ the [=control thread=] event loop to invoke the
+ {{VideoDecoder/[[error callback]]}} with |exception|.
@@ -805,6 +819,10 @@
The number of pending encode requests. This number will decrease as the
underlying codec is ready to accept new input.
+[[pending flush promises]]
+
+ A list of unresolved promises returned by calls to {{AudioEncoder/flush()}}.
+
Constructors {#audioencoder-constructors}
@@ -905,7 +923,8 @@
[=a promise rejected with=] {{InvalidStateError}} {{DOMException}}.
2. Let |promise| be a new Promise.
3. [=Queue a control message=] to flush the codec with |promise|.
- 4. Return |promise|.
+ 4. Append |promise| to {{AudioEncoder/[[pending flush promises]]}}.
+ 5. Return |promise|.
[=Running a control message=] to flush the codec means performing these steps
with |promise|.
@@ -913,10 +932,12 @@
pending outputs=].
2. Let |encoded outputs| be a [=list=] of encoded audio data outputs
emitted by {{AudioEncoder/[[codec implementation]]}}.
- 5. If |encoded outputs| is not empty, queue a task on the [=control thread=]
+ 3. If |encoded outputs| is not empty, queue a task on the [=control thread=]
event loop to run the [=Output EncodedAudioChunks=] algorithm with
|encoded outputs|.
- 3. Queue a task on the [=control thread=] event loop to resolve |promise|.
+ 4. Queue a task on the [=control thread=] event loop to run these steps:
+ 1. Remove |promise| from {{AudioEncoder/[[pending flush promises]]}}.
+ 2. Resolve |promise|.
reset()
@@ -925,7 +946,8 @@
[=control messages=] in the [=control message queue=], and all pending
callbacks.
- When invoked, run the [=Reset AudioEncoder=] algorithm.
+ When invoked, run the [=Reset AudioEncoder=] algorithm with an
+ {{AbortError}} {{DOMException}}.
close()
@@ -933,7 +955,8 @@
Immediately aborts all pending work and releases [=system resources=].
Close is final.
- When invoked, run the [=Close AudioEncoder=] algorithm.
+ When invoked, run the [=Close AudioEncoder=] algorithm with an
+ {{AbortError}} {{DOMException}}.
isConfigSupported(config)
@@ -1014,7 +1037,7 @@
7. Invoke {{AudioEncoder/[[output callback]]}} with |chunk| and
|chunkMetadata|.
- Reset AudioEncoder
+ Reset AudioEncoder (with |exception|)
Run these steps:
1. If {{AudioEncoder/[[state]]}} is `"closed"`, throw an {{InvalidStateError}}.
@@ -1023,18 +1046,22 @@
4. Set {{AudioEncoder/[[active output config]]}} to `null`.
5. Signal {{AudioEncoder/[[codec implementation]]}} to cease producing
output for the previous configuration.
- 6. [=Reset the control message queue=].
+ 6. Remove all [=control messages=] from the [=control message queue=].
7. Set {{AudioEncoder/[[encodeQueueSize]]}} to zero.
+ 8. For each |promise| in {{AudioEncoder/[[pending flush promises]]}}:
+ 1. Reject |promise| with |exception|.
+ 2. Remove |promise| from {{AudioEncoder/[[pending flush promises]]}}.
- Close AudioEncoder (with |error|)
+ Close AudioEncoder (with |exception|)
Run these steps:
- 1. Run the [=Reset AudioEncoder=] algorithm.
+ 1. Run the [=Reset AudioEncoder=] algorithm with |exception|.
2. Set {{AudioEncoder/[[state]]}} to `"closed"`.
3. Clear {{AudioEncoder/[[codec implementation]]}} and release associated
[=system resources=].
- 4. If |error| is set, queue a task on the [=control thread=] event loop
- invoke the {{AudioEncoder/[[error callback]]}} with |error|.
+ 4. If |exception| is not an {{AbortError}} {{DOMException}}, queue a task on
+ the [=control thread=] event loop to invoke the
+ {{AudioDecoder/[[error callback]]}} with |exception|.
@@ -1110,6 +1137,10 @@
The number of pending encode requests. This number will decrease as the
underlying codec is ready to accept new input.
+[[pending flush promises]]
+
+ A list of unresolved promises returned by calls to {{VideoEncoder/flush()}}.
+
Constructors {#videoencoder-constructors}
@@ -1209,7 +1240,8 @@
[=a promise rejected with=] {{InvalidStateError}} {{DOMException}}.
2. Let |promise| be a new Promise.
3. [=Queue a control message=] to flush the codec with |promise|.
- 4. Return |promise|.
+ 4. Append |promise| to {{VideoEncoder/[[pending flush promises]]}}.
+ 5. Return |promise|.
[=Running a control message=] to flush the codec means performing these steps
with |promise|.
@@ -1217,10 +1249,12 @@
pending outputs=].
2. Let |encoded outputs| be a [=list=] of encoded video data outputs
emitted by {{VideoEncoder/[[codec implementation]]}}.
- 5. If |encoded outputs| is not empty, queue a task on the [=control thread=]
+ 3. If |encoded outputs| is not empty, queue a task on the [=control thread=]
event loop to run the [=Output EncodedVideoChunks=] algorithm with
|encoded outputs|.
- 3. Queue a task on the [=control thread=] event loop to resolve |promise|.
+ 4. Queue a task on the [=control thread=] event loop to run these steps:
+ 1. Remove |promise| from {{VideoEncoder/[[pending flush promises]]}}.
+ 2. Resolve |promise|.
reset()
@@ -1229,7 +1263,8 @@
[=control messages=] in the [=control message queue=], and all pending
callbacks.
- When invoked, run the [=Reset VideoEncoder=] algorithm.
+ When invoked, run the [=Reset VideoEncoder=] algorithm with an
+ {{AbortError}} {{DOMException}}.
close()
@@ -1237,7 +1272,8 @@
Immediately aborts all pending work and releases [=system resources=].
Close is final.
- When invoked, run the [=Close VideoEncoder=] algorithm.
+ When invoked, run the [=Close VideoEncoder=] algorithm with an
+ {{AbortError}} {{DOMException}}.
isConfigSupported(config)
@@ -1327,7 +1363,7 @@
8. Invoke {{VideoEncoder/[[output callback]]}} with |chunk| and
|chunkMetadata|.
- Reset VideoEncoder
+ Reset VideoEncoder (with |exception|)
Run these steps:
1. If {{VideoEncoder/[[state]]}} is `"closed"`, throw an {{InvalidStateError}}.
@@ -1336,18 +1372,21 @@
4. Set {{VideoEncoder/[[active output config]]}} to `null`.
5. Signal {{VideoEncoder/[[codec implementation]]}} to cease producing
output for the previous configuration.
- 6. [=Reset the control message queue=].
+ 6. Remove all [=control messages=] from the [=control message queue=].
7. Set {{VideoEncoder/[[encodeQueueSize]]}} to zero.
+ 8. For each |promise| in {{VideoEncoder/[[pending flush promises]]}}:
+ 1. Reject |promise| with |exception|.
+ 2. Remove |promise| from {{VideoEncoder/[[pending flush promises]]}}.
- Close VideoEncoder (with |error|)
+ Close VideoEncoder (with |exception|)
Run these steps:
- 1. Run the [=Reset VideoEncoder=] algorithm.
+ 1. Run the [=Reset VideoEncoder=] algorithm with |exception|.
2. Set {{VideoEncoder/[[state]]}} to `"closed"`.
3. Clear {{VideoEncoder/[[codec implementation]]}} and release associated
[=system resources=].
- 4. If |error| is set, queue a task on the [=control thread=] event loop
- invoke the {{VideoEncoder/[[error callback]]}} with |error|.
+ 4. If |exception| is not an {{AbortError}} {{DOMException}}, queue a task on
+ the [=control thread=] event loop to invoke the {{AudioDecoder/[[error callback]]}} with |exception|.
@@ -3280,14 +3319,14 @@
:: Immediately aborts all pending work.
When invoked, run the [=ImageDecoder/Reset ImageDecoder=] algorithm with
- and {{AbortError}} {{DOMException}}.
+ an {{AbortError}} {{DOMException}}.
: close()
:: Immediately aborts all pending work and releases system resources. Close is
final.
When invoked, run the [=ImageDecoder/Close ImageDecoder=] algorithm with
- and {{AbortError}} {{DOMException}}.
+ an {{AbortError}} {{DOMException}}.
: isTypeSupported(type)
:: Returns a promise indicating whether the provided config is supported by the