Skip to content

Commit 8f7384f

Browse files
committed
Specify audio codec registration priming sample handling (#944)
Update codec registry entry requirements and add Priming Samples sections for Opus, MP3, and AAC describing how [[priming samples to discard]] is initialized and updated. See #944 See #626 TAG=agy CONV=fb1a957f-7551-4aa1-b394-2244fb156d73
1 parent 91160a4 commit 8f7384f

4 files changed

Lines changed: 42 additions & 0 deletions

File tree

‎aac_codec_registration.src.html‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,24 @@
104104
any time without error, but this might not result in the expected audio
105105
output.
106106

107+
Priming Samples {#priming-samples}
108+
==================================
109+
110+
Standard AAC bitstreams do not typically convey priming samples, and
111+
{{AudioDecoder}}'s {{AudioDecoder/[[priming samples to discard]]}} internal slot
112+
is initialized to `0` upon configuration.
113+
114+
If the initial {{EncodedAudioChunk}} following configuration or reset conveys
115+
in-band encoder delay information (for example, through an encoder
116+
identification string in an extension payload fill element),
117+
{{AudioDecoder/[[priming samples to discard]]}} <em class="rfc2119">MAY</em> be
118+
set to that number of priming samples.
119+
120+
Subsequent {{EncodedAudioChunk}}s <em class="rfc2119">MUST NOT</em> update
121+
{{AudioDecoder/[[priming samples to discard]]}}. During an active decoding
122+
session, {{AudioDecoder/[[priming samples to discard]]}} is only re-initialized
123+
following a call to {{AudioDecoder/reset()}} or {{AudioDecoder/configure()}}.
124+
107125
AudioEncoderConfig extensions {#audioencoderconfig-extensions}
108126
==============================================================
109127

‎codec_registry.src.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
4. Expectations for {{EncodedAudioChunk}} or {{EncodedVideoChunk}}
7979
{{EncodedVideoChunk/[[type]]}}.
8080
4. Where applicable, a registration specification may include a section describing [=partial dictionary|extensions to the dictionaries=] used in the `configure()`, `decode()` and `encode()` methods of the decoder and encoder interfaces (e.g., {{AudioDecoderConfig}}, {{VideoDecoderConfig}}, {{AudioEncoderConfig}}, {{VideoEncoderConfig}}, {{VideoEncoderEncodeOptions}}).
81+
5. Where applicable, an audio codec registration specification SHOULD describe how {{AudioDecoder}}'s {{AudioDecoder/[[priming samples to discard]]}} internal slot is initialized from the {{AudioDecoderConfig/description}} and updated from decoded chunks. If unspecified for an audio codec, the slot is initialized to `0` and not updated.
8182

8283
Once consensus is reached by the Working Group, the registry editors will review and merge the pull request.
8384

‎mp3_codec_registration.src.html‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,24 @@
8080
any time without error, but this might not result in the expected audio
8181
output.
8282

83+
Priming Samples {#priming-samples}
84+
==================================
85+
86+
{{AudioDecoder}}'s {{AudioDecoder/[[priming samples to discard]]}} internal slot
87+
is initialized to `0` upon configuration.
88+
89+
If the initial {{EncodedAudioChunk}} following configuration or reset contains
90+
an Info or Xing header frame specifying encoder delay,
91+
{{AudioDecoder/[[priming samples to discard]]}} is set to that number of
92+
priming samples.
93+
94+
If a subsequent {{EncodedAudioChunk}} contains an Info or Xing header frame (such
95+
as in a concatenated MP3 stream or internet radio broadcast), it <em
96+
class="rfc2119">MUST NOT</em> update {{AudioDecoder/[[priming samples to
97+
discard]]}}. During an active decoding session, {{AudioDecoder/[[priming samples
98+
to discard]]}} is only re-initialized following a call to
99+
{{AudioDecoder/reset()}} or {{AudioDecoder/configure()}}.
100+
83101
Privacy Considerations {#privacy-considerations}
84102
==========================================================================
85103

‎opus_codec_registration.src.html‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@
9090
NOTE: Once the initialization has succeeded, any packet can be decoded at any
9191
time without error, but this might not result in the expected audio output.
9292

93+
Priming Samples {#priming-samples}
94+
==================================
95+
96+
The `Pre-skip` field in the Identification Header (see section 5.1 of [[OPUS-IN-OGG]]), if present in {{AudioDecoderConfig/description}}, specifies the initial value for {{AudioDecoder}}'s {{AudioDecoder/[[priming samples to discard]]}} internal slot. If {{AudioDecoderConfig/description}} is not present, {{AudioDecoder/[[priming samples to discard]]}} is initialized to `0`. Decoded {{EncodedAudioChunk}}s do not convey additional discard information.
97+
9398
AudioEncoderConfig extensions {#audioencoderconfig-extensions}
9499
=============================================================
95100

0 commit comments

Comments
 (0)