Skip to content

Commit 3856bbf

Browse files
authored
Merge pull request w3c#721 from youennf/improve-configure-queue-model
Update configure methods to use a parallel queue to run the the configuration check support
2 parents 261401a + cdc456f commit 3856bbf

File tree

1 file changed

+101
-94
lines changed

1 file changed

+101
-94
lines changed

index.src.html

Lines changed: 101 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@
245245

246246
Each [=codec=] instance has an internal slot named
247247
<dfn>[[codec implementation]]</dfn> that refers to the underlying platform
248-
encoder or decoder. Except for assignment, any steps that reference
248+
encoder or decoder. Except for the initial assignment, any steps that reference
249249
[=[[codec implementation]]=] will be enqueued to the [=[[codec work queue]]=].
250250

251251
Each [=codec=] instance has a unique <dfn>codec task source</dfn>. Tasks
@@ -381,19 +381,20 @@
381381

382382
[=Running a control message=] to configure the decoder means running
383383
these steps:
384-
1. Let |supported| be the result of running the <a>Check Configuration
385-
Support</a> algorithm with |config|.
386-
2. If |supported| is `true`, assign
387-
{{AudioDecoder/[[codec implementation]]}} with an implementation
388-
supporting |config|.
389-
3. Otherwise, run the <a>Close AudioDecoder</a> algorithm with
390-
{{NotSupportedError}} and return `"processed"`.
391-
4. Assign `true` to {{AudioDecoder/[[message queue blocked]]}}.
392-
5. Enqueue the following steps to {{AudioDecoder/[[codec work queue]]}}:
393-
1. Configure {{AudioDecoder/[[codec implementation]]}} with |config|.
394-
2. Assign `false` to {{AudioDecoder/[[message queue blocked]]}}.
395-
3. [=Queue a task=] to [=Process the control message queue=].
396-
6. Return `"processed"`.
384+
1. Assign `true` to {{AudioDecoder/[[message queue blocked]]}}.
385+
1. Enqueue the following steps to {{AudioDecoder/[[codec work queue]]}}:
386+
1. Let |supported| be the result of running the <a>Check Configuration
387+
Support</a> algorithm with |config|.
388+
2. If |supported| is `false`, [=queue a task=] to run the <a>Close
389+
AudioDecoder</a> algorithm with {{NotSupportedError}} and abort
390+
these steps.
391+
3. If needed, assign {{AudioDecoder/[[codec implementation]]}} with an
392+
implementation supporting |config|.
393+
4. Configure {{AudioDecoder/[[codec implementation]]}} with |config|.
394+
5. [=queue a task=] to run the following steps:
395+
1. Assign `false` to {{AudioDecoder/[[message queue blocked]]}}.
396+
2. [=Queue a task=] to [=Process the control message queue=].
397+
3. Return `"processed"`.
397398
</dd>
398399

399400
<dt><dfn method for=AudioDecoder>decode(chunk)</dfn></dt>
@@ -509,14 +510,16 @@
509510
3. Let |checkSupportQueue| be the result of starting a new <a>parallel
510511
queue</a>.
511512
4. Enqueue the following steps to |checkSupportQueue|:
512-
1. Let |decoderSupport| be a newly constructed
513-
{{AudioDecoderSupport}}, initialized as follows:
514-
1. Set {{AudioDecoderSupport/config}} to the result of running the
515-
<a>Clone Configuration</a> algorithm with |config|.
516-
2. Set {{AudioDecoderSupport/supported}} to the result of running
517-
the <a>Check Configuration Support</a> algorithm with |config|.
518-
2. Resolve |p| with |decoderSupport|.
519-
5. Return |p|.
513+
1. Let |supported| be the result of running
514+
the <a>Check Configuration Support</a> algorithm with |config|.
515+
2. [=Queue a task=] to run the following steps:
516+
1. Let |decoderSupport| be a newly constructed
517+
{{AudioDecoderSupport}}, initialized as follows:
518+
1. Set {{AudioDecoderSupport/config}} to the result of running the
519+
<a>Clone Configuration</a> algorithm with |config|.
520+
2. Set {{AudioDecoderSupport/supported}} to |supported|.
521+
2. Resolve |p| with |decoderSupport|.
522+
5. Return |p|.
520523
</dd>
521524
</dl>
522525

@@ -576,7 +579,7 @@
576579
3. Clear {{AudioDecoder/[[codec implementation]]}} and release associated
577580
[=system resources=].
578581
4. If |exception| is not an {{AbortError}} {{DOMException}},
579-
[=queue a task=] to invoke the {{AudioDecoder/[[error callback]]}} with |exception|.
582+
invoke the {{AudioDecoder/[[error callback]]}} with |exception|.
580583
</dd>
581584
</dl>
582585

@@ -712,20 +715,20 @@
712715

713716
[=Running a control message=] to configure the decoder means running
714717
these steps:
715-
1. Let |supported| be the result of running the <a>Check Configuration
716-
Support</a> algorithm with |config|.
717-
2. If |supported| is `true`, assign
718-
{{VideoDecoder/[[codec implementation]]}} with an implementation
719-
supporting |config|.
720-
3. Otherwise, run the <a>Close VideoDecoder</a> algorithm with
721-
{{NotSupportedError}} and return `"processed"`.
722-
4. Assign `true` to {{VideoDecoder/[[message queue blocked]]}}.
723-
5. Enqueue the following steps to {{VideoDecoder/[[codec work queue]]}}:
724-
1. Configure {{VideoDecoder/[[codec implementation]]}} with |config|.
725-
2. Set {{VideoDecoder/[[active decoder config]]}} to `config`.
726-
3. Assign `false` to {{VideoDecoder/[[message queue blocked]]}}.
727-
4. [=Queue a task=] to [=Process the control message queue=].
728-
6. Return `"processed"`.
718+
1. Assign `true` to {{VideoDecoder/[[message queue blocked]]}}.
719+
1. Enqueue the following steps to {{VideoDecoder/[[codec work queue]]}}:
720+
1. Let |supported| be the result of running the <a>Check Configuration
721+
Support</a> algorithm with |config|.
722+
2. If |supported| is `false`, [=queue a task=] to run the <a>Close
723+
VideoDecoder</a> algorithm with {{NotSupportedError}} and abort
724+
these steps.
725+
3. If needed, assign {{VideoDecoder/[[codec implementation]]}} with an
726+
implementation supporting |config|.
727+
4. Configure {{VideoDecoder/[[codec implementation]]}} with |config|.
728+
5. [=queue a task=] to run the following steps:
729+
1. Assign `false` to {{VideoDecoder/[[message queue blocked]]}}.
730+
2. [=Queue a task=] to [=Process the control message queue=].
731+
3. Return `"processed"`.
729732
</dd>
730733

731734
<dt><dfn method for=VideoDecoder>decode(chunk)</dfn></dt>
@@ -852,14 +855,16 @@
852855
3. Let |checkSupportQueue| be the result of starting a new <a>parallel
853856
queue</a>.
854857
4. Enqueue the following steps to |checkSupportQueue|:
855-
1. Let |decoderSupport| be a newly constructed
856-
{{VideoDecoderSupport}}, initialized as follows:
857-
1. Set {{VideoDecoderSupport/config}} to the result of running the
858-
<a>Clone Configuration</a> algorithm with |config|.
859-
2. Set {{VideoDecoderSupport/supported}} to the result of running
860-
the <a>Check Configuration Support</a> algorithm with |config|.
861-
2. Resolve |p| with |decoderSupport|.
862-
5. Return |p|.
858+
1. Let |supported| be the result of running
859+
the <a>Check Configuration Support</a> algorithm with |config|.
860+
2. [=Queue a task=] to run the following steps:
861+
1. Let |decoderSupport| be a newly constructed
862+
{{VideoDecoderSupport}}, initialized as follows:
863+
1. Set {{VideoDecoderSupport/config}} to the result of running the
864+
<a>Clone Configuration</a> algorithm with |config|.
865+
2. Set {{VideoDecoderSupport/supported}} to |supported|.
866+
2. Resolve |p| with |decoderSupport|.
867+
5. Return |p|.
863868
</dd>
864869
</dl>
865870

@@ -929,7 +934,7 @@
929934
3. Clear {{VideoDecoder/[[codec implementation]]}} and release associated
930935
[=system resources=].
931936
4. If |exception| is not an {{AbortError}} {{DOMException}},
932-
[=queue a task=] to invoke the {{VideoDecoder/[[error callback]]}} with |exception|.
937+
invoke the {{VideoDecoder/[[error callback]]}} with |exception|.
933938
</dd>
934939
</dl>
935940

@@ -1065,20 +1070,20 @@
10651070

10661071
[=Running a control message=] to configure the encoder means performing
10671072
these steps:
1068-
1. Let |supported| be the result of running the <a>Check Configuration
1069-
Support</a> algorithm with |config|.
1070-
2. If |supported| is `true`, assign
1071-
{{AudioEncoder/[[codec implementation]]}} with an implementation
1072-
supporting |config|.
1073-
3. Otherwise, run the <a>Close AudioEncoder</a> algorithm with
1074-
{{NotSupportedError}} and return `"processed"`.
1075-
4. Assign `true` to {{AudioEncoder/[[message queue blocked]]}}.
1076-
5. Enqueue the following steps to {{AudioEncoder/[[codec work queue]]}}:
1077-
1. Configure {{AudioEncoder/[[codec implementation]]}} with |config|.
1078-
2. Set {{AudioEncoder/[[active encoder config]]}} to `config`.
1079-
3. Assign `false` to {{AudioEncoder/[[message queue blocked]]}}.
1080-
4. [=Queue a task=] to [=Process the control message queue=].
1081-
6. Return `"processed"`.
1073+
1. Assign `true` to {{AudioEncoder/[[message queue blocked]]}}.
1074+
2. Enqueue the following steps to {{AudioEncoder/[[codec work queue]]}}:
1075+
1. Let |supported| be the result of running the <a>Check Configuration
1076+
Support</a> algorithm with |config|.
1077+
2. If |supported| is `false`, [=queue a task=] to run the <a>Close
1078+
AudioEncoder</a> algorithm with {{NotSupportedError}} and abort
1079+
these steps.
1080+
3. If needed, assign {{AudioEncoder/[[codec implementation]]}} with an
1081+
implementation supporting |config|.
1082+
4. Configure {{AudioEncoder/[[codec implementation]]}} with |config|.
1083+
5. [=queue a task=] to run the following steps:
1084+
1. Assign `false` to {{AudioEncoder/[[message queue blocked]]}}.
1085+
2. [=Queue a task=] to [=Process the control message queue=].
1086+
3. Return `"processed"`.
10821087
</dd>
10831088

10841089
<dt><dfn method for=AudioEncoder>encode(data)</dfn></dt>
@@ -1188,14 +1193,16 @@
11881193
3. Let |checkSupportQueue| be the result of starting a new <a>parallel
11891194
queue</a>.
11901195
4. Enqueue the following steps to |checkSupportQueue|:
1191-
1. Let |encoderSupport| be a newly constructed
1192-
{{AudioEncoderSupport}}, initialized as follows:
1193-
1. Set {{AudioEncoderSupport/config}} to the result of running the
1194-
<a>Clone Configuration</a> algorithm with |config|.
1195-
2. Set {{AudioEncoderSupport/supported}} to the result of running
1196-
the <a>Check Configuration Support</a> algorithm with |config|.
1197-
2. Resolve |p| with |encoderSupport|.
1198-
5. Return |p|.
1196+
1. Let |supported| be the result of running
1197+
the <a>Check Configuration Support</a> algorithm with |config|.
1198+
2. [=Queue a task=] to run the following steps:
1199+
1. Let |encoderSupport| be a newly constructed
1200+
{{AudioEncoderSupport}}, initialized as follows:
1201+
1. Set {{AudioEncoderSupport/config}} to the result of running the
1202+
<a>Clone Configuration</a> algorithm with |config|.
1203+
2. Set {{AudioEncoderSupport/supported}} to |supported|.
1204+
2. Resolve |p| with |encoderSupport|.
1205+
5. Return |p|.
11991206
</dd>
12001207
</dl>
12011208

@@ -1285,8 +1292,7 @@
12851292
3. Clear {{AudioEncoder/[[codec implementation]]}} and release associated
12861293
[=system resources=].
12871294
4. If |exception| is not an {{AbortError}} {{DOMException}},
1288-
[=queue a task=] to invoke the
1289-
{{AudioEncoder/[[error callback]]}} with |exception|.
1295+
invoke the {{AudioEncoder/[[error callback]]}} with |exception|.
12901296
</dd>
12911297
</dl>
12921298

@@ -1439,20 +1445,20 @@
14391445

14401446
[=Running a control message=] to configure the encoder means performing
14411447
these steps:
1442-
1. Let |supported| be the result of running the <a>Check Configuration
1443-
Support</a> algorithm with |config|.
1444-
2. If |supported| is `true`, assign
1445-
{{VideoEncoder/[[codec implementation]]}} with an implementation
1446-
supporting |config|.
1447-
3. Otherwise, run the <a>Close VideoEncoder</a> algorithm with
1448-
{{NotSupportedError}} and return `"processed"`.
1449-
4. Assign `true` to {{VideoEncoder/[[message queue blocked]]}}.
1450-
5. Enqueue the following steps to {{VideoEncoder/[[codec work queue]]}}:
1451-
1. Configure {{VideoEncoder/[[codec implementation]]}} with |config|.
1452-
2. Set {{VideoEncoder/[[active encoder config]]}} to `config`.
1453-
3. Assign `false` to {{VideoEncoder/[[message queue blocked]]}}.
1454-
4. [=Queue a task=] to [=Process the control message queue=].
1455-
6. Return `"processed"`.
1448+
1. Assign `true` to {{VideoEncoder/[[message queue blocked]]}}.
1449+
1. Enqueue the following steps to {{VideoEncoder/[[codec work queue]]}}:
1450+
1. Let |supported| be the result of running the <a>Check Configuration
1451+
Support</a> algorithm with |config|.
1452+
2. If |supported| is `false`, [=queue a task=] to run the <a>Close
1453+
VideoEncoder</a> algorithm with {{NotSupportedError}} and abort
1454+
these steps.
1455+
3. If needed, assign {{VideoEncoder/[[codec implementation]]}} with an
1456+
implementation supporting |config|.
1457+
4. Configure {{VideoEncoder/[[codec implementation]]}} with |config|.
1458+
5. [=queue a task=] to run the following steps:
1459+
1. Assign `false` to {{VideoEncoder/[[message queue blocked]]}}.
1460+
2. [=Queue a task=] to [=Process the control message queue=].
1461+
3. Return `"processed"`.
14561462
</dd>
14571463

14581464
<dt><dfn method for=VideoEncoder>encode(|frame|, |options|)</dfn></dt>
@@ -1562,14 +1568,16 @@
15621568
3. Let |checkSupportQueue| be the result of starting a new <a>parallel
15631569
queue</a>.
15641570
4. Enqueue the following steps to |checkSupportQueue|:
1565-
1. Let |encoderSupport| be a newly constructed
1566-
{{VideoEncoderSupport}}, initialized as follows:
1567-
1. Set {{VideoEncoderSupport/config}} to the result of running the
1568-
<a>Clone Configuration</a> algorithm with |config|.
1569-
2. Set {{VideoEncoderSupport/supported}} to the result of running
1570-
the <a>Check Configuration Support</a> algorithm with |config|.
1571-
2. Resolve |p| with |encoderSupport|.
1572-
5. Return |p|.
1571+
1. Let |supported| be the result of running
1572+
the <a>Check Configuration Support</a> algorithm with |config|.
1573+
2. [=Queue a task=] to run the following steps:
1574+
1. Let |encoderSupport| be a newly constructed
1575+
{{VideoEncoderSupport}}, initialized as follows:
1576+
1. Set {{VideoEncoderSupport/config}} to the result of running the
1577+
<a>Clone Configuration</a> algorithm with |config|.
1578+
2. Set {{VideoEncoderSupport/supported}} to |supported|.
1579+
2. Resolve |p| with |encoderSupport|.
1580+
5. Return |p|.
15731581
</dd>
15741582
</dl>
15751583

@@ -1674,8 +1682,7 @@
16741682
3. Clear {{VideoEncoder/[[codec implementation]]}} and release associated
16751683
[=system resources=].
16761684
4. If |exception| is not an {{AbortError}} {{DOMException}},
1677-
[=queue a task=] to invoke the {{VideoEncoder/[[error callback]]}} with
1678-
|exception|.
1685+
invoke the {{VideoEncoder/[[error callback]]}} with |exception|.
16791686
</dd>
16801687
</dl>
16811688

0 commit comments

Comments
 (0)