diff --git a/index.src.html b/index.src.html index b6adba8f..b871105d 100644 --- a/index.src.html +++ b/index.src.html @@ -127,6 +127,11 @@ inputs are provided. The underlying codec implementation MUST emit all outputs in response to a flush. +: Priming Samples +:: Audio samples produced at the start of decoding that represent encoder delay + or filter warm-up and are not part of the original audio content. Also + commonly referred to as "encoder delay" or "pre-skip". + : Codec System Resources :: Resources including CPU memory, GPU memory, and exclusive handles to specific decoding/encoding hardware that MAY be allocated by @@ -334,6 +339,9 @@ : [[dequeue event scheduled]] :: A boolean indicating whether a {{AudioDecoder/dequeue}} event is already scheduled to fire. Used to avoid event spam. +: [[priming samples to discard]] +:: An integer representing the number of [=priming samples=] remaining to be + discarded from decoded audio outputs. Constructors {#audiodecoder-constructors} ----------------------------------------- @@ -354,7 +362,8 @@ 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. +14. Assign `0` to {{AudioDecoder/[[priming samples to discard]]}}. +15. Return d. Attributes {#audiodecoder-attributes} ------------------------------------- @@ -407,7 +416,12 @@ 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: + 5. Assign {{AudioDecoder/[[priming samples to discard]]}} with the + number of [=priming samples=] indicated by + |config|.{{AudioDecoderConfig/description}}, as defined by the + codec's registration in the [[WEBCODECS-CODEC-REGISTRY]], or `0` + if not specified. + 6. [=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"`. @@ -443,18 +457,21 @@ 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 + 1. If |chunk| contains [=priming samples=] information, update + {{AudioDecoder/[[priming samples to discard]]}} as defined by the + codec's registration in the [[WEBCODECS-CODEC-REGISTRY]]. + 2. Attempt to use {{AudioDecoder/[[codec implementation]]}} to decode the chunk. - 2. If decoding results in an error, [=queue a task=] to run the + 3. 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 + 4. 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 + 5. 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 + 6. If |decoded outputs| is not empty, [=queue a task=] to run the [=Output AudioData=] algorithm with |decoded outputs|. 5. Return `"processed"`. @@ -555,22 +572,33 @@