-
Notifications
You must be signed in to change notification settings - Fork 139
/
index.src.html
6307 lines (5445 loc) · 281 KB
/
index.src.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<pre class='metadata'>
Title: WebCodecs
Repository: w3c/webcodecs
Status: ED
ED: https://w3c.github.io/webcodecs/
TR: https://www.w3.org/TR/webcodecs/
Shortname: webcodecs
Level: None
Group: mediawg
Editor: Paul Adenot, w3cid 62410, Mozilla https://www.mozilla.org/
Editor: Bernard Aboba, w3cid 65611, Microsoft Corporation https://www.microsoft.com/
Editor: Eugene Zemtsov, w3cid 139375, Google LLC https://www.google.com/
Former Editor: Chris Cunningham, w3cid 114832, Google Inc. https://www.google.com/
Abstract: This specification defines interfaces to codecs for encoding and
decoding of audio, video, and images.
This specification does not specify or require any particular codec or
method of encoding or decoding. The purpose of this specification is to
provide JavaScript interfaces to implementations of existing codec
technology developed elsewhere. Implementers are free to
support any combination of codecs or none at all.
Complain About:accidental-2119 yes
Markup Shorthands:css no, markdown yes, dfn yes
!Participate: <a href="https://github.com/w3c/webcodecs">Git Repository.</a>
!Participate: <a href="https://github.com/w3c/webcodecs/issues/new">File an issue.</a>
!Version History: <a href="https://github.com/w3c/webcodecs/commits">https://github.com/w3c/webcodecs/commits</a>
</pre>
<pre class=link-defaults>
spec:html; type:attribute; text:hidden
spec:html; type:enum-value; text:srgb
spec:infra; type:dfn; text:list
spec:infra; type:dfn; text:enqueue
spec:webaudio-1.1; type:interface; text:AudioWorklet
spec:webaudio-1.1; type:interface; text:AudioBuffer
</pre>
<pre class='anchors'>
spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/;
for: ImageBitmap;
type: dfn; text: bitmap data; url: imagebitmap-and-animations.html#concept-imagebitmap-bitmap-data
for: ImageData
type: dfn; text: canvas pixel data; url: canvas.html#imagedata
for: Canvas;
type: dfn; text: Check the usability of the image argument; url: canvas.html#check-the-usability-of-the-image-argument
type: dfn; text: is not origin-clean; url: canvas.html#the-image-argument-is-not-origin-clean
for: webappapis;
type: dfn; text: entry settings object; url: webappapis.html#entry-settings-object
for: media;
type: dfn; text: current playback position; url: media.html#current-playback-position
type: dfn; text: live; url: infrastructure.html#live
spec: webrtc-svc; urlPrefix: https://www.w3.org/TR/webrtc-svc/
type: dfn; text: scalability mode identifier; url:#scalabilitymodes*
spec: mst-content-hint; urlPrefix: https://www.w3.org/TR/mst-content-hint/
type: dfn; text: video content hints; url:#video-content-hints
spec: ECMASCRIPT; urlPrefix: https://tc39.es/ecma262/
type: dfn; text: the current Realm; url: #current-realm
</pre>
<pre class='biblio'>
{
"H.273": {
"href": "https://www.itu.int/rec/T-REC-H.273/en",
"title": "Coding-independent code points for video signal type identification",
"publisher": "ITU",
"date": "December 2016"
},
"WEBCODECS-VIDEO-FRAME-METADATA-REGISTRY": {
"href": "https://w3c.github.io/webcodecs/video_frame_metadata_registry.html",
"title": "WebCodecs VideoFrame Metadata Registry",
"publisher": "W3C",
"authors": [
"Youenn Fablet"
],
"status": "ED"
}
}
</pre>
<style>
main > dl > dd {
margin-bottom: 1em;
}
table {
width: 100%;
}
table#sample-types td, table#sample-types th {
text-align: center;
}
table#sample-types .even {
background-color: lightgrey;
}
.rfc2119 {
text-transform: lowercase;
font-variant: small-caps;
font-style: normal;
}
</style>
Definitions {#definitions}
==========================
: <dfn>Codec</dfn>
:: Refers generically to an instance of {{AudioDecoder}}, {{AudioEncoder}},
{{VideoDecoder}}, or {{VideoEncoder}}.
: <dfn lt="Key Chunk|Key Frame">Key Chunk</dfn>
:: An encoded chunk that does not depend on any other frames for decoding. Also
commonly referred to as a "key frame".
: <dfn>Internal Pending Output</dfn>
:: Codec outputs such as {{VideoFrame}}s that currently reside in the internal
pipeline of the underlying codec implementation. The underlying codec
implementation <em class="rfc2119">MAY</em> emit new outputs only when new
inputs are provided. The underlying codec implementation <em
class="rfc2119">MUST</em> emit all outputs in response to a flush.
: <dfn lt="system resources">Codec System Resources</dfn>
:: Resources including CPU memory, GPU memory, and exclusive handles to specific
decoding/encoding hardware that <em class="rfc2119">MAY</em> be allocated by
the User Agent as part of codec configuration or generation of {{AudioData}}
and {{VideoFrame}} objects. Such resources <em class="rfc2119">MAY</em> be
quickly exhausted and <em class="rfc2119">SHOULD</em> be released immediately
when no longer in use.
: <dfn>Temporal Layer</dfn>
:: A grouping of {{EncodedVideoChunk}}s whose timestamp cadence produces a
particular framerate. See {{VideoEncoderConfig/scalabilityMode}}.
: <dfn>Progressive Image</dfn>
:: An image that supports decoding to multiple levels of detail, with lower
levels becoming available while the encoded data is not yet fully buffered.
: <dfn>Progressive Image Frame Generation</dfn>
:: A generational identifier for a given [=Progressive Image=] decoded output.
Each successive generation adds additional detail to the decoded output.
The mechanism for computing a frame's generation is implementer defined.
: <dfn>Primary Image Track</dfn>
:: An image track that is marked by the given image file as being the default
track. The mechanism for indicating a primary track is format defined.
: <dfn>RGB Format</dfn>
:: A {{VideoPixelFormat}} containing red, green, and blue color channels in
any order or layout (interleaved or planar), and irrespective of whether an
alpha channel is present.
: <dfn>sRGB Color Space</dfn>
:: A {{VideoColorSpace}} object, initialized as follows:
1. {{VideoColorSpace/[[primaries]]}} is set to {{VideoColorPrimaries/bt709}},
2. {{VideoColorSpace/[[transfer]]}} is set to {{VideoTransferCharacteristics/iec61966-2-1}},
3. {{VideoColorSpace/[[matrix]]}} is set to {{VideoMatrixCoefficients/rgb}},
4. {{VideoColorSpace/[[full range]]}} is set to `true`
: <dfn>Display P3 Color Space</dfn>
:: A {{VideoColorSpace}} object, initialized as follows:
1. {{VideoColorSpace/[[primaries]]}} is set to {{VideoColorPrimaries/smpte432}},
2. {{VideoColorSpace/[[transfer]]}} is set to {{VideoTransferCharacteristics/iec61966-2-1}},
3. {{VideoColorSpace/[[matrix]]}} is set to {{VideoMatrixCoefficients/rgb}},
4. {{VideoColorSpace/[[full range]]}} is set to `true`
: <dfn>REC709 Color Space</dfn>
:: A {{VideoColorSpace}} object, initialized as follows:
1. {{VideoColorSpace/[[primaries]]}} is set to {{VideoColorPrimaries/bt709}},
2. {{VideoColorSpace/[[transfer]]}} is set to {{VideoTransferCharacteristics/bt709}},
3. {{VideoColorSpace/[[matrix]]}} is set to {{VideoMatrixCoefficients/bt709}},
4. {{VideoColorSpace/[[full range]]}} is set to `false`
: <dfn lt="saturated">Codec Saturation</dfn>
:: The state of an underlying codec implementation where the number of active
decoding or encoding requests has reached an implementation specific
maximum such that it is temporarily unable to accept more work. The maximum
may be any value greater than 1, including infinity (no maximum). While
saturated, additional calls to `decode()` or `encode()` will be buffered
in the [=control message queue=], and will increment the respective
`decodeQueuSize` and `encodeQueueSize` attributes. The codec implementation
will become unsaturated after making sufficient progress on the current
workload.
<dfn>Codec Processing Model</dfn> {#codec-processing-model-section}
===================================================================
Background {#processing-model-background}
-----------------------------------------
<div class=non-normative>
This section is non-normative.
The codec interfaces defined by the specification are designed such that new
codec tasks can be scheduled while previous tasks are still pending. For
example, web authors can call `decode()` without waiting for a previous
`decode()` to complete. This is achieved by offloading underlying codec tasks
to a separate [=parallel queue=] for parallel execution.
This section describes threading behaviors as they are visible from the
perspective of web authors. Implementers can choose to use more threads, as
long as the externally visible behaviors of blocking and sequencing are
maintained as follows.
</div>
Control Messages {#control-messages}
------------------------------------
A <dfn>control message</dfn> defines a sequence of steps corresponding to a
method invocation on a [=codec=] instance (e.g. `encode()`).
A <dfn>control message queue</dfn> is a [=queue=] of
[=control messages=]. Each [=codec=] instance has a control message queue
stored in an internal slot named
<dfn id='control-message-queue-slot'>[[control message queue]]</dfn>.
<dfn lt="Enqueues a control message|Queue a control message">Queuing a control
message</dfn> means [=enqueuing=] the message to a [=codec=]’s [=[[control
message queue]]=]. Invoking codec methods will generally queue a control message
to schedule work.
<dfn lt="running a control message|control message steps">Running a control
message</dfn> means performing a sequence of steps specified by the method
that enqueued the message.
The steps of a given control message can block processing later messages in the
control message queue. Each [=codec=] instance has a boolean internal slot named
<dfn>[[message queue blocked]]</dfn> that is set to `true` when this occurs. A
blocking message will conclude by setting [=[[message queue blocked]]=] to
`false` and rerunning the [=Process the control message queue=] steps.
All control messages will return either `"processed"` or `"not processed"`.
Returning `"processed"` indicates the message steps are being (or have been)
executed and the message may be removed from the [=control message queue=].
`"not processed"` indicates the message must not be processed at this time
and should remain in the [=control message queue=] to be retried later.
To <dfn>Process the control message queue</dfn>, run these steps:
1. While [=[[message queue blocked]]=] is `false` and
[=[[control message queue]]=] is not empty:
1. Let |front message| be the first message in
[=[[control message queue]]=].
2. Let |outcome| be the result of running the [=control message steps=]
described by |front message|.
3. If |outcome| equals `"not processed"`, break.
4. Otherwise, dequeue |front message| from the
[=[[control message queue]]=].
Codec Work Parallel Queue {#codec-work-parallel-queue}
------------------------------------------------------
Each [=codec=] instance has an internal slot named
<dfn>[[codec work queue]]</dfn> that is a [=parallel queue=].
Each [=codec=] instance has an internal slot named
<dfn>[[codec implementation]]</dfn> that refers to the underlying platform
encoder or decoder. Except for the initial assignment, any steps that reference
[=[[codec implementation]]=] will be enqueued to the [=[[codec work queue]]=].
Each [=codec=] instance has a unique <dfn>codec task source</dfn>. Tasks
[=queue a task|queued=] from the [=[[codec work queue]]=] to the [=/event loop=]
will use the [=codec task source=].
AudioDecoder Interface {#audiodecoder-interface}
================================================
<xmp class='idl'>
[Exposed=(Window,DedicatedWorker), SecureContext]
interface AudioDecoder : EventTarget {
constructor(AudioDecoderInit init);
readonly attribute CodecState state;
readonly attribute unsigned long decodeQueueSize;
attribute EventHandler ondequeue;
undefined configure(AudioDecoderConfig config);
undefined decode(EncodedAudioChunk chunk);
Promise<undefined> flush();
undefined reset();
undefined close();
static Promise<AudioDecoderSupport> isConfigSupported(AudioDecoderConfig config);
};
dictionary AudioDecoderInit {
required AudioDataOutputCallback output;
required WebCodecsErrorCallback error;
};
callback AudioDataOutputCallback = undefined(AudioData output);
</xmp>
Internal Slots {#audiodecoder-internal-slots}
---------------------------------------------
: <dfn attribute for=AudioDecoder>[[control message queue]]</dfn>
:: A [=queue=] of [=control messages=] to be performed upon this [=codec=]
instance. See [=[[control message queue]]=].
: <dfn attribute for=AudioDecoder>[[message queue blocked]]</dfn>
:: A boolean indicating when processing the
{{AudioDecoder/[[control message queue]]}} is blocked by a pending
[=control message=]. See [=[[message queue blocked]]=].
: <dfn attribute for=AudioDecoder>[[codec implementation]]</dfn>
:: Underlying decoder implementation provided by the User Agent. See
[=[[codec implementation]]=].
: <dfn attribute for=AudioDecoder>[[codec work queue]]</dfn>
:: A [=parallel queue=] used for running parallel steps that reference the
{{AudioDecoder/[[codec implementation]]}}. See [=[[codec work queue]]=].
: <dfn attribute for=AudioDecoder>[[codec saturated]]</dfn>
:: A boolean indicating when the {{AudioDecoder/[[codec implementation]]}} is
unable to accept additional decoding work.
: <dfn attribute for=AudioDecoder>[[output callback]]</dfn>
:: Callback given at construction for decoded outputs.
: <dfn attribute for=AudioDecoder>[[error callback]]</dfn>
:: Callback given at construction for decode errors.
: <dfn attribute for=AudioDecoder>[[key chunk required]]</dfn>
:: A boolean indicating that the next chunk passed to {{AudioDecoder/decode()}}
<em class="rfc2119">MUST</em> describe a [=key chunk=] as indicated by
{{EncodedAudioChunk/[[type]]}}.
: <dfn attribute for=AudioDecoder>\[[state]]</dfn>
:: The current {{CodecState}} of this {{AudioDecoder}}.
: <dfn attribute for=AudioDecoder>\[[decodeQueueSize]]</dfn>
:: The number of pending decode requests. This number will decrease as the
underlying codec is ready to accept new input.
: <dfn attribute for=AudioDecoder>[[pending flush promises]]</dfn>
:: A list of unresolved promises returned by calls to {{AudioDecoder/flush()}}.
: <dfn attribute for=AudioDecoder>[[dequeue event scheduled]]</dfn>
:: A boolean indicating whether a {{AudioDecoder/dequeue}} event is already
scheduled to fire. Used to avoid event spam.
Constructors {#audiodecoder-constructors}
-----------------------------------------
<dfn constructor for=AudioDecoder title="AudioDecoder(init)">
AudioDecoder(init)
</dfn>
1. Let d be a new {{AudioDecoder}} object.
2. Assign a new [=queue=] to {{AudioDecoder/[[control message queue]]}}.
3. Assign `false` to {{AudioDecoder/[[message queue blocked]]}}.
4. Assign `null` to {{AudioDecoder/[[codec implementation]]}}.
5. Assign the result of starting a new [=parallel queue=] to
{{AudioDecoder/[[codec work queue]]}}.
6. Assign `false` to {{AudioDecoder/[[codec saturated]]}}.
7. Assign init.output to {{AudioDecoder/[[output callback]]}}.
8. Assign init.error to {{AudioDecoder/[[error callback]]}}.
9. Assign `true` to {{AudioDecoder/[[key chunk required]]}}.
10. Assign `"unconfigured"` to {{AudioDecoder/[[state]]}}
11. Assign `0` to {{AudioDecoder/[[decodeQueueSize]]}}.
12. Assign a new [=list=] to {{AudioDecoder/[[pending flush promises]]}}.
13. Assign `false` to {{AudioDecoder/[[dequeue event scheduled]]}}.
13. Return d.
Attributes {#audiodecoder-attributes}
-------------------------------------
: <dfn attribute for=AudioDecoder>state</dfn>
:: Returns the value of {{AudioDecoder/[[state]]}}.
: <dfn attribute for=AudioDecoder>decodeQueueSize</dfn>
:: Returns the value of {{AudioDecoder/[[decodeQueueSize]]}}.
: <dfn attribute for=AudioDecoder>ondequeue</dfn>
:: An [=event handler IDL attribute=] whose [=event handler event type=] is
{{AudioDecoder/dequeue}}.
Event Summary {#audiodecoder-event-summary}
-------------------------------------------
: <dfn event for=AudioDecoder>dequeue</dfn>
:: Fired at the {{AudioDecoder}} when the {{AudioDecoder/decodeQueueSize}} has
decreased.
Methods {#audiodecoder-methods}
-------------------------------
<dl>
<dt><dfn method for=AudioDecoder>configure(config)</dfn></dt>
<dd>
[=Enqueues a control message=] to configure the audio decoder for decoding
chunks as described by |config|.
NOTE: This method will trigger a {{NotSupportedError}} if the User Agent
does not support |config|. Authors are encouraged to first check support
by calling {{AudioDecoder/isConfigSupported()}} with |config|. User
Agents don't have to support any particular codec type or configuration.
When invoked, run these steps:
1. If |config| is not a [=valid AudioDecoderConfig=], throw a
{{TypeError}}.
2. If {{AudioDecoder/[[state]]}} is `“closed”`, throw an {{InvalidStateError}}.
3. Set {{AudioDecoder/[[state]]}} to `"configured"`.
4. Set {{AudioDecoder/[[key chunk required]]}} to `true`.
5. [=Queue a control message=] to configure the decoder with |config|.
6. [=Process the control message queue=].
[=Running a control message=] to configure the decoder means running
these steps:
1. Assign `true` to {{AudioDecoder/[[message queue blocked]]}}.
2. Enqueue the following steps to {{AudioDecoder/[[codec work queue]]}}:
1. Let |supported| be the result of running the <a>Check Configuration
Support</a> algorithm with |config|.
2. If |supported| is `false`, [=queue a task=] to run the <a>Close
AudioDecoder</a> algorithm with {{NotSupportedError}} and abort
these steps.
3. If needed, assign {{AudioDecoder/[[codec implementation]]}} with an
implementation supporting |config|.
4. Configure {{AudioDecoder/[[codec implementation]]}} with |config|.
5. [=queue a task=] to run the following steps:
1. Assign `false` to {{AudioDecoder/[[message queue blocked]]}}.
2. [=Queue a task=] to [=Process the control message queue=].
3. Return `"processed"`.
</dd>
<dt><dfn method for=AudioDecoder>decode(chunk)</dfn></dt>
<dd>
[=Enqueues a control message=] to decode the given |chunk|.
When invoked, run these steps:
1. If {{AudioDecoder/[[state]]}} is not `"configured"`, throw an
{{InvalidStateError}}.
2. If {{AudioDecoder/[[key chunk required]]}} is `true`:
1. If |chunk|.{{EncodedAudioChunk/[[type]]}} is not
{{EncodedAudioChunkType/key}}, throw a {{DataError}}.
2. Implementers <em class="rfc2119">SHOULD</em> inspect the |chunk|'s
{{EncodedAudioChunk/[[internal data]]}} to verify that
it is truly a [=key chunk=]. If a mismatch is detected, throw a
{{DataError}}.
3. Otherwise, assign `false` to
{{AudioDecoder/[[key chunk required]]}}.
3. Increment {{AudioDecoder/[[decodeQueueSize]]}}.
4. [=Queue a control message=] to decode the |chunk|.
5. [=Process the control message queue=].
[=Running a control message=] to decode the chunk means performing these
steps:
1. If {{AudioDecoder/[[codec saturated]]}} equals `true`, return `"not
processed"`.
2. If decoding chunk will cause the
{{AudioDecoder/[[codec implementation]]}} to become [=saturated=],
assign `true` to {{AudioDecoder/[[codec saturated]]}}.
3. Decrement {{AudioDecoder/[[decodeQueueSize]]}} and run the
[=AudioDecoder/Schedule Dequeue Event=] algorithm.
4. Enqueue the following steps to the {{AudioDecoder/[[codec work queue]]}}:
1. Attempt to use {{AudioDecoder/[[codec implementation]]}} to decode
the chunk.
2. If decoding results in an error, [=queue a task=] to run the
[=Close AudioDecoder=] algorithm with {{EncodingError}} and return.
3. If {{AudioDecoder/[[codec saturated]]}} equals `true` and
{{AudioDecoder/[[codec implementation]]}} is no longer
[=saturated=], [=queue a task=] to perform the following steps:
1. Assign `false` to {{AudioDecoder/[[codec saturated]]}}.
2. [=Process the control message queue=].
4. Let |decoded outputs| be a [=list=] of decoded audio data outputs
emitted by {{AudioDecoder/[[codec implementation]]}}.
5. If |decoded outputs| is not empty, [=queue a task=] to run the
[=Output AudioData=] algorithm with |decoded outputs|.
5. Return `"processed"`.
</dd>
<dt><dfn method for=AudioDecoder>flush()</dfn></dt>
<dd>
Completes all [=control messages=] in the [=control message queue=]
and emits all outputs.
When invoked, run these steps:
1. If {{AudioDecoder/[[state]]}} is not `"configured"`, return
[=a promise rejected with=] {{InvalidStateError}} {{DOMException}}.
2. Set {{AudioDecoder/[[key chunk required]]}} to `true`.
3. Let |promise| be a new Promise.
4. Append |promise| to {{AudioDecoder/[[pending flush promises]]}}.
5. [=Queue a control message=] to flush the codec with |promise|.
6. [=Process the control message queue=].
7. Return |promise|.
[=Running a control message=] to flush the codec means performing these
steps with |promise|.
1. Enqueue the following steps to the {{AudioDecoder/[[codec work queue]]}}:
1. Signal {{AudioDecoder/[[codec implementation]]}} to emit all
[=internal pending outputs=].
2. Let |decoded outputs| be a [=list=] of decoded audio data outputs
emitted by {{AudioDecoder/[[codec implementation]]}}.
3. [=Queue a task=] to perform these steps:
1. If |decoded outputs| is not empty, run the [=Output AudioData=]
algorithm with |decoded outputs|.
2. Remove |promise| from
{{AudioDecoder/[[pending flush promises]]}}.
3. Resolve |promise|.
2. Return `"processed"`.
</dd>
<dt><dfn method for=AudioDecoder>reset()</dfn></dt>
<dd>
Immediately resets all state including configuration,
[=control messages=] in the [=control message queue=], and all pending
callbacks.
When invoked, run the [=Reset AudioDecoder=] algorithm with an
{{AbortError}} {{DOMException}}.
</dd>
<dt><dfn method for=AudioDecoder>close()</df></dt>
<dd>
Immediately aborts all pending work and releases [=system resources=].
Close is final.
When invoked, run the [=Close AudioDecoder=] algorithm with an
{{AbortError}} {{DOMException}}.
</dd>
<dt><dfn method for=AudioDecoder>isConfigSupported(config)</dfn></dt>
<dd>
Returns a promise indicating whether the provided |config| is supported by
the User Agent.
NOTE: The returned {{AudioDecoderSupport}} {{AudioDecoderSupport/config}}
will contain only the dictionary members that User Agent recognized.
Unrecognized dictionary members will be ignored. Authors can detect
unrecognized dictionary members by comparing
{{AudioDecoderSupport/config}} to their provided |config|.
When invoked, run these steps:
1. If |config| is not a <a>valid AudioDecoderConfig</a>, return
[=a promise rejected with=] {{TypeError}}.
2. Let |p| be a new Promise.
3. Let |checkSupportQueue| be the result of starting a new <a>parallel
queue</a>.
4. Enqueue the following steps to |checkSupportQueue|:
1. Let |supported| be the result of running
the <a>Check Configuration Support</a> algorithm with |config|.
2. [=Queue a task=] to run the following steps:
1. Let |decoderSupport| be a newly constructed
{{AudioDecoderSupport}}, initialized as follows:
1. Set {{AudioDecoderSupport/config}} to the result of running the
<a>Clone Configuration</a> algorithm with |config|.
2. Set {{AudioDecoderSupport/supported}} to |supported|.
2. Resolve |p| with |decoderSupport|.
5. Return |p|.
</dd>
</dl>
Algorithms {#audiodecoder-algorithms}
-------------------------------------
<dl>
<dt><dfn for=AudioDecoder>Schedule Dequeue Event</dfn>
<dd>
1. If {{AudioDecoder/[[dequeue event scheduled]]}} equals `true`, return.
2. Assign `true` to {{AudioDecoder/[[dequeue event scheduled]]}}.
3. [=Queue a task=] to run the following steps:
1. Fire a simple event named {{AudioDecoder/dequeue}} at [=this=].
2. Assign `false` to {{AudioDecoder/[[dequeue event scheduled]]}}.
</dd>
<dt><dfn>Output AudioData</dfn> (with |outputs|)</dt>
<dd>
Run these steps:
1. For each |output| in |outputs|:
1. Let |data| be an {{AudioData}}, initialized as follows:
1. Assign `false` to {{platform object/[[Detached]]}}.
2. Let |resource| be the [=media resource=] described by |output|.
3. Let |resourceReference| be a reference to |resource|.
4. Assign |resourceReference| to
{{AudioData/[[resource reference]]}}.
5. Let |timestamp| be the {{EncodedAudioChunk/[[timestamp]]}} of the
{{EncodedAudioChunk}} associated with |output|.
6. Assign |timestamp| to {{AudioData/[[timestamp]]}}.
7. If |output| uses a recognized {{AudioSampleFormat}}, assign that
format to {{AudioData/[[format]]}}. Otherwise, assign `null` to
{{AudioData/[[format]]}}.
8. Assign values to {{AudioData/[[sample rate]]}},
{{AudioData/[[number of frames]]}}, and
{{AudioData/[[number of channels]]}} as determined by |output|.
3. Invoke {{AudioDecoder/[[output callback]]}} with |data|.
</dd>
<dt><dfn>Reset AudioDecoder</dfn> (with |exception|)</dt>
<dd>
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. Remove all [=control messages=] from the
{{AudioDecoder/[[control message queue]]}}.
5. If {{AudioDecoder/[[decodeQueueSize]]}} is greater than zero:
1. Set {{AudioDecoder/[[decodeQueueSize]]}} to zero.
2. Run the [=AudioDecoder/Schedule Dequeue Event=] algorithm.
6. For each |promise| in {{AudioDecoder/[[pending flush promises]]}}:
1. Reject |promise| with |exception|.
2. Remove |promise| from {{AudioDecoder/[[pending flush promises]]}}.
</dd>
<dt><dfn>Close AudioDecoder</dfn> (with |exception|)</dt>
<dd>
Run these steps:
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 |exception| is not an {{AbortError}} {{DOMException}},
invoke the {{AudioDecoder/[[error callback]]}} with |exception|.
</dd>
</dl>
VideoDecoder Interface {#videodecoder-interface}
================================================
<xmp class='idl'>
[Exposed=(Window,DedicatedWorker), SecureContext]
interface VideoDecoder : EventTarget {
constructor(VideoDecoderInit init);
readonly attribute CodecState state;
readonly attribute unsigned long decodeQueueSize;
attribute EventHandler ondequeue;
undefined configure(VideoDecoderConfig config);
undefined decode(EncodedVideoChunk chunk);
Promise<undefined> flush();
undefined reset();
undefined close();
static Promise<VideoDecoderSupport> isConfigSupported(VideoDecoderConfig config);
};
dictionary VideoDecoderInit {
required VideoFrameOutputCallback output;
required WebCodecsErrorCallback error;
};
callback VideoFrameOutputCallback = undefined(VideoFrame output);
</xmp>
Internal Slots {#videodecoder-internal-slots}
---------------------------------------------
: <dfn attribute for=VideoDecoder>[[control message queue]]</dfn>
:: A [=queue=] of [=control messages=] to be performed upon this [=codec=]
instance. See [=[[control message queue]]=].
: <dfn attribute for=VideoDecoder>[[message queue blocked]]</dfn>
:: A boolean indicating when processing the
{{VideoDecoder/[[control message queue]]}} is blocked by a pending
[=control message=]. See [=[[message queue blocked]]=].
: <dfn attribute for=VideoDecoder>[[codec implementation]]</dfn>
:: Underlying decoder implementation provided by the User Agent. See
[=[[codec implementation]]=].
: <dfn attribute for=VideoDecoder>[[codec work queue]]</dfn>
:: A [=parallel queue=] used for running parallel steps that reference the
{{VideoDecoder/[[codec implementation]]}}. See [=[[codec work queue]]=].
: <dfn attribute for=VideoDecoder>[[codec saturated]]</dfn>
:: A boolean indicating when the {{VideoDecoder/[[codec implementation]]}} is
unable to accept additional decoding work.
: <dfn attribute for=VideoDecoder>[[output callback]]</dfn>
:: Callback given at construction for decoded outputs.
: <dfn attribute for=VideoDecoder>[[error callback]]</dfn>
:: Callback given at construction for decode errors.
: <dfn attribute for=VideoDecoder>[[active decoder config]]</dfn>
:: The {{VideoDecoderConfig}} that is actively applied.
: <dfn attribute for=VideoDecoder>[[key chunk required]]</dfn>
:: A boolean indicating that the next chunk passed to {{VideoDecoder/decode()}}
<em class="rfc2119">MUST</em> describe a [=key chunk=] as indicated by
{{EncodedVideoChunk/type}}.
: <dfn attribute for=VideoDecoder>\[[state]]</dfn>
:: The current {{CodecState}} of this {{VideoDecoder}}.
: <dfn attribute for=VideoDecoder>\[[decodeQueueSize]]</dfn>
:: The number of pending decode requests. This number will decrease as the
underlying codec is ready to accept new input.
: <dfn attribute for=VideoDecoder>[[pending flush promises]]</dfn>
:: A list of unresolved promises returned by calls to {{VideoDecoder/flush()}}.
: <dfn attribute for=VideoDecoder>[[dequeue event scheduled]]</dfn>
:: A boolean indicating whether a {{VideoDecoder/dequeue}} event is already
scheduled to fire. Used to avoid event spam.
Constructors {#videodecoder-constructors}
-----------------------------------------
<dfn constructor for=VideoDecoder title="VideoDecoder(init)">
VideoDecoder(init)
</dfn>
1. Let d be a new {{VideoDecoder}} object.
2. Assign a new [=queue=] to {{VideoDecoder/[[control message queue]]}}.
3. Assign `false` to {{VideoDecoder/[[message queue blocked]]}}.
4. Assign `null` to {{VideoDecoder/[[codec implementation]]}}.
5. Assign the result of starting a new [=parallel queue=] to
{{VideoDecoder/[[codec work queue]]}}.
6. Assign `false` to {{VideoDecoder/[[codec saturated]]}}.
7. Assign init.output to {{VideoDecoder/[[output callback]]}}.
8. Assign init.error to {{VideoDecoder/[[error callback]]}}.
9. Assign `null` to {{VideoDecoder/[[active decoder config]]}}.
10. Assign `true` to {{VideoDecoder/[[key chunk required]]}}.
11. Assign `"unconfigured"` to {{VideoDecoder/[[state]]}}
12. Assign `0` to {{VideoDecoder/[[decodeQueueSize]]}}.
13. Assign a new [=list=] to {{VideoDecoder/[[pending flush promises]]}}.
14. Assign `false` to {{VideoDecoder/[[dequeue event scheduled]]}}.
15. Return d.
Attributes {#videodecoder-attributes}
-------------------------------------
: <dfn attribute for=VideoDecoder>state</dfn>
:: Returns the value of {{VideoDecoder/[[state]]}}.
: <dfn attribute for=VideoDecoder>decodeQueueSize</dfn>
:: Returns the value of {{VideoDecoder/[[decodeQueueSize]]}}.
: <dfn attribute for=VideoDecoder>ondequeue</dfn>
:: An [=event handler IDL attribute=] whose [=event handler event type=] is
{{VideoDecoder/dequeue}}.
Event Summary {#videodecoder-event-summary}
-------------------------------------------
: <dfn event for=VideoDecoder>dequeue</dfn>
:: Fired at the {{VideoDecoder}} when the {{VideoDecoder/decodeQueueSize}} has
decreased.
Methods {#videodecoder-methods}
-------------------------------
<dl>
<dt><dfn method for=VideoDecoder>configure(config)</dfn></dt>
<dd>
[=Enqueues a control message=] to configure the video decoder for decoding
chunks as described by |config|.
NOTE: This method will trigger a {{NotSupportedError}} if the User Agent
does not support |config|. Authors are encouraged to first check support
by calling {{VideoDecoder/isConfigSupported()}} with |config|. User Agents
don't have to support any particular codec type or configuration.
When invoked, run these steps:
1. If |config| is not a [=valid VideoDecoderConfig=], throw a
{{TypeError}}.
2. If {{VideoDecoder/[[state]]}} is `“closed”`, throw an
{{InvalidStateError}}.
3. Set {{VideoDecoder/[[state]]}} to `"configured"`.
4. Set {{VideoDecoder/[[key chunk required]]}} to `true`.
5. [=Queue a control message=] to configure the decoder with |config|.
6. [=Process the control message queue=].
[=Running a control message=] to configure the decoder means running
these steps:
1. Assign `true` to {{VideoDecoder/[[message queue blocked]]}}.
2. Enqueue the following steps to {{VideoDecoder/[[codec work queue]]}}:
1. Let |supported| be the result of running the <a>Check Configuration
Support</a> algorithm with |config|.
2. If |supported| is `false`, [=queue a task=] to run the <a>Close
VideoDecoder</a> algorithm with {{NotSupportedError}} and abort
these steps.
3. If needed, assign {{VideoDecoder/[[codec implementation]]}} with an
implementation supporting |config|.
4. Configure {{VideoDecoder/[[codec implementation]]}} with |config|.
5. [=queue a task=] to run the following steps:
1. Assign `false` to {{VideoDecoder/[[message queue blocked]]}}.
2. [=Queue a task=] to [=Process the control message queue=].
3. Return `"processed"`.
</dd>
<dt><dfn method for=VideoDecoder>decode(chunk)</dfn></dt>
<dd>
[=Enqueues a control message=] to decode the given |chunk|.
NOTE: Authors are encouraged to call {{VideoFrame/close()}} on output
{{VideoFrame}}s immediately when frames are no longer needed. The
underlying [=media resource=]s are owned by the {{VideoDecoder}} and
failing to release them (or waiting for garbage collection) can cause
decoding to stall.
NOTE: {{VideoDecoder}} requires that frames are output in the order they
expect to be presented, commonly known as presentation order. When using
some {{VideoDecoder/[[codec implementation]]}}s the User Agent will have
to reorder outputs into presentation order.
When invoked, run these steps:
1. If {{VideoDecoder/[[state]]}} is not `"configured"`, throw an
{{InvalidStateError}}.
2. If {{VideoDecoder/[[key chunk required]]}} is `true`:
1. If |chunk|.{{EncodedVideoChunk/type}} is not
{{EncodedVideoChunkType/key}}, throw a {{DataError}}.
2. Implementers <em class="rfc2119">SHOULD</em> inspect the |chunk|'s
{{EncodedVideoChunk/[[internal data]]}} to verify that
it is truly a [=key chunk=]. If a mismatch is detected, throw a
{{DataError}}.
3. Otherwise, assign `false` to
{{VideoDecoder/[[key chunk required]]}}.
3. Increment {{VideoDecoder/[[decodeQueueSize]]}}.
4. [=Queue a control message=] to decode the |chunk|.
5. [=Process the control message queue=].
[=Running a control message=] to decode the chunk means performing these steps:
1. If {{VideoDecoder/[[codec saturated]]}} equals `true`, return `"not
processed"`.
2. If decoding chunk will cause the
{{VideoDecoder/[[codec implementation]]}} to become [=saturated=],
assign `true` to {{VideoDecoder/[[codec saturated]]}}.
3. Decrement {{VideoDecoder/[[decodeQueueSize]]}} and run the
[=VideoDecoder/Schedule Dequeue Event=] algorithm.
4. Enqueue the following steps to the {{VideoDecoder/[[codec work queue]]}}:
1. Attempt to use {{VideoDecoder/[[codec implementation]]}} to decode
the chunk.
2. If decoding results in an error, [=queue a task=] to run the
[=Close VideoDecoder=] algorithm with {{EncodingError}} and return.
3. If {{VideoDecoder/[[codec saturated]]}} equals `true` and
{{VideoDecoder/[[codec implementation]]}} is no longer
[=saturated=], [=queue a task=] to perform the following steps:
1. Assign `false` to {{VideoDecoder/[[codec saturated]]}}.
2. [=Process the control message queue=].
4. Let |decoded outputs| be a [=list=] of decoded video data outputs
emitted by {{VideoDecoder/[[codec implementation]]}} in
presentation order.
5. If |decoded outputs| is not empty, [=queue a task=] to run the
[=Output VideoFrame=] algorithm with |decoded outputs|.
5. Return `"processed"`.
</dd>
<dt><dfn method for=VideoDecoder>flush()</dfn></dt>
<dd>
Completes all [=control messages=] in the [=control message queue=]
and emits all outputs.
When invoked, run these steps:
1. If {{VideoDecoder/[[state]]}} is not `"configured"`, return
[=a promise rejected with=] {{InvalidStateError}} {{DOMException}}.
2. Set {{VideoDecoder/[[key chunk required]]}} to `true`.
3. Let |promise| be a new Promise.
4. Append |promise| to {{VideoDecoder/[[pending flush promises]]}}.
5. [=Queue a control message=] to flush the codec with |promise|.
6. [=Process the control message queue=].
7. Return |promise|.
[=Running a control message=] to flush the codec means performing these
steps with |promise|.
1. Enqueue the following steps to the {{VideoDecoder/[[codec work queue]]}}:
1. Signal {{VideoDecoder/[[codec implementation]]}} to emit all
[=internal pending outputs=].
2. Let |decoded outputs| be a [=list=] of decoded video data outputs
emitted by {{VideoDecoder/[[codec implementation]]}}.
3. [=Queue a task=] to perform these steps:
1. If |decoded outputs| is not empty, run the [=Output VideoFrame=]
algorithm with |decoded outputs|.
2. Remove |promise| from
{{VideoDecoder/[[pending flush promises]]}}.
3. Resolve |promise|.
2. Return `"processed"`.
</dd>
<dt><dfn method for=VideoDecoder>reset()</dfn></dt>
<dd>
Immediately resets all state including configuration,
[=control messages=] in the [=control message queue=], and all pending
callbacks.
When invoked, run the [=Reset VideoDecoder=] algorithm with an
{{AbortError}} {{DOMException}}.
</dd>
<dt><dfn method for=VideoDecoder>close()</df></dt>
<dd>
Immediately aborts all pending work and releases [=system resources=].
Close is final.
When invoked, run the [=Close VideoDecoder=] algorithm with an
{{AbortError}} {{DOMException}}.
</dd>
<dt><dfn method for=VideoDecoder>isConfigSupported(config)</dfn></dt>
<dd>
Returns a promise indicating whether the provided |config| is supported by
the User Agent.
NOTE: The returned {{VideoDecoderSupport}} {{VideoDecoderSupport/config}}
will contain only the dictionary members that User Agent recognized.
Unrecognized dictionary members will be ignored. Authors can detect
unrecognized dictionary members by comparing
{{VideoDecoderSupport/config}} to their provided |config|.
When invoked, run these steps:
1. If |config| is not a <a>valid VideoDecoderConfig</a>, return
[=a promise rejected with=] {{TypeError}}.
2. Let |p| be a new Promise.
3. Let |checkSupportQueue| be the result of starting a new <a>parallel
queue</a>.
4. Enqueue the following steps to |checkSupportQueue|:
1. Let |supported| be the result of running
the <a>Check Configuration Support</a> algorithm with |config|.
2. [=Queue a task=] to run the following steps:
1. Let |decoderSupport| be a newly constructed
{{VideoDecoderSupport}}, initialized as follows:
1. Set {{VideoDecoderSupport/config}} to the result of running the
<a>Clone Configuration</a> algorithm with |config|.
2. Set {{VideoDecoderSupport/supported}} to |supported|.
2. Resolve |p| with |decoderSupport|.
5. Return |p|.
</dd>
</dl>
Algorithms {#videodecoder-algorithms}
-------------------------------------
<dl>
<dt><dfn for=VideoDecoder>Schedule Dequeue Event</dfn>
<dd>
1. If {{VideoDecoder/[[dequeue event scheduled]]}} equals `true`, return.
2. Assign `true` to {{VideoDecoder/[[dequeue event scheduled]]}}.
3. [=Queue a task=] to run the following steps:
1. Fire a simple event named {{VideoDecoder/dequeue}} at [=this=].
2. Assign `false` to {{VideoDecoder/[[dequeue event scheduled]]}}.
</dd>
<dt><dfn>Output VideoFrames</dfn> (with |outputs|)</dt>
<dd>
Run these steps:
1. For each |output| in |outputs|:
1. Let |timestamp| and |duration| be the
{{EncodedVideoChunk/timestamp}} and {{EncodedVideoChunk/duration}}
from the {{EncodedVideoChunk}} associated with |output|.
2. Let |displayAspectWidth| and |displayAspectHeight| be undefined.
3. If {{VideoDecoderConfig/displayAspectWidth}} and
{{VideoDecoderConfig/displayAspectHeight}} [=map/exist=] in the
{{VideoDecoder/[[active decoder config]]}}, assign their values to
|displayAspectWidth| and |displayAspectHeight| respectively.
4. Let |colorSpace| be the {{VideoColorSpace}} for |output| as detected
by the codec implementation. If no {{VideoColorSpace}} is detected,
let |colorSpace| be `undefined`.
NOTE: The codec implementation can detect a {{VideoColorSpace}} by
analyzing the bitstream. Detection is made on a best-effort
basis. The exact method of detection is implementer defined and
codec-specific. Authors can override the detected
{{VideoColorSpace}} by providing a
{{VideoDecoderConfig/colorSpace}} in the {{VideoDecoderConfig}}.
5. If {{VideoDecoderConfig/colorSpace}} [=map/exists=] in the
{{VideoDecoder/[[active decoder config]]}}, assign its value to
|colorSpace|.
6. Let |frame| be the result of running the [=Create a VideoFrame=]
algorithm with |output|, |timestamp|, |duration|,
|displayAspectWidth|, |displayAspectHeight|, and |colorSpace|.
7. Invoke {{VideoDecoder/[[output callback]]}} with |frame|.
</dd>
<dt><dfn>Reset VideoDecoder</dfn> (with |exception|)</dt>
<dd>
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. Remove all [=control messages=] from the
{{VideoDecoder/[[control message queue]]}}.
5. If {{VideoDecoder/[[decodeQueueSize]]}} is greater than zero:
1. Set {{VideoDecoder/[[decodeQueueSize]]}} to zero.
2. Run the [=VideoDecoder/Schedule Dequeue Event=] algorithm.
6. For each |promise| in {{VideoDecoder/[[pending flush promises]]}}:
1. Reject |promise| with |exception|.
2. Remove |promise| from {{VideoDecoder/[[pending flush promises]]}}.
</dd>
<dt><dfn>Close VideoDecoder</dfn> (with |exception|)</dt>
<dd>
Run these steps:
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 |exception| is not an {{AbortError}} {{DOMException}},
invoke the {{VideoDecoder/[[error callback]]}} with |exception|.
</dd>
</dl>
AudioEncoder Interface {#audioencoder-interface}
================================================
<xmp class='idl'>
[Exposed=(Window,DedicatedWorker), SecureContext]
interface AudioEncoder : EventTarget {
constructor(AudioEncoderInit init);
readonly attribute CodecState state;
readonly attribute unsigned long encodeQueueSize;
attribute EventHandler ondequeue;
undefined configure(AudioEncoderConfig config);
undefined encode(AudioData data);
Promise<undefined> flush();
undefined reset();
undefined close();
static Promise<AudioEncoderSupport> isConfigSupported(AudioEncoderConfig config);
};
dictionary AudioEncoderInit {
required EncodedAudioChunkOutputCallback output;
required WebCodecsErrorCallback error;
};
callback EncodedAudioChunkOutputCallback =
undefined (EncodedAudioChunk output,
optional EncodedAudioChunkMetadata metadata = {});
</xmp>
Internal Slots {#audioencoder-internal-slots}
---------------------------------------------
: <dfn attribute for=AudioEncoder>[[control message queue]]</dfn>
:: A [=queue=] of [=control messages=] to be performed upon this [=codec=]
instance. See [=[[control message queue]]=].
: <dfn attribute for=AudioEncoder>[[message queue blocked]]</dfn>
:: A boolean indicating when processing the
{{AudioEncoder/[[control message queue]]}} is blocked by a pending
[=control message=]. See [=[[message queue blocked]]=].
: <dfn attribute for=AudioEncoder>[[codec implementation]]</dfn>
:: Underlying encoder implementation provided by the User Agent. See