diff --git a/drafts/draft-lcurley-moq-hang.md b/drafts/draft-lcurley-moq-hang.md index 52a1d75e579..09036411fef 100644 --- a/drafts/draft-lcurley-moq-hang.md +++ b/drafts/draft-lcurley-moq-hang.md @@ -944,6 +944,7 @@ Audio publishers do not append per-group duration markers because the codec defi Data tracks retain empty payloads as data, without endpoint semantics. For example, h.264 with no `description` field would be annex.b encoded, while h.264 with a `description` field would be AVCC encoded. +For AAC (`mp4a.40.*`), each nonempty codec payload MUST be one complete ADTS frame when `description` is absent; with an AudioSpecificConfig in `description`, it MUST be one raw AAC access unit without an ADTS header. For a text track, the remainder is the cue in the track's declared `format` (for example a `WEBVTT` segment). ## cmaf @@ -961,6 +962,7 @@ A consumer MUST feed `init` to the decoder before the first frame. ## loc Each frame is a Low Overhead Container frame {{!I-D.ietf-moq-loc}}: a property block, carrying the timestamp among other properties, followed by the codec payload. +The codec payload uses the same framing as {{legacy}}. For audio and video, consumers accept empty codec payload metadata with the same video-duration and audio-terminal-trimming meanings as the legacy container. Data tracks retain empty payloads as data. @@ -1162,6 +1164,7 @@ This document has no IANA actions. ## moq-hang-04 {:numbered="false"} +- Defined AAC payloads without a `description` as ADTS, and payloads with an AudioSpecificConfig as raw AAC. - A `broadcast` reference and an echo `path` are spelled like a path: one with an empty segment or a lone `\` refuses the catalog instead of collapsing. - Removed `catalog.json.z` and the data track `compression` field: compression is a track property the transport carries ({{compression}}), so each compressed track is one name, and the catalog, `stats` and `echo` snapshots, HLS record tracks, and JSON data tracks SHOULD be compressed. - Replaced the root `archive` section and its per-track timelines with an optional, per-rendition `hls` field on video and audio ({{hls}}). Each record is a segment's first `group` and `pts` in milliseconds, with an optional `duration` where zero marks a stop; frame positions, `end`, `keyframe`, `timescale`, `replay`, `replayEpoch`, `store`, and `version` are gone. Each rendition numbers its own segments, and an edge maps a rendition's record `n` to its segment `n`. The record track is named `.hls` and is compressed ({{compression}}). diff --git a/js/hang/src/util/libav.test.ts b/js/hang/src/util/libav.test.ts index ac6cc86b3fc..8b1706ed343 100644 --- a/js/hang/src/util/libav.test.ts +++ b/js/hang/src/util/libav.test.ts @@ -10,13 +10,13 @@ const SAMPLE_RATE = 48000; // -filter_complex amerge -c:a aac -b:a 64k -f adts libav.test.aac const FIXTURE = new URL("./libav.test.aac", import.meta.url); -// Strip the ADTS headers: a hang catalog carries the AudioSpecificConfig and frames are raw. -function rawFrames(adts: Uint8Array): Uint8Array[] { +// A description selects raw blocks; without one, each packet keeps its ADTS header. +function aacFrames(adts: Uint8Array, raw: boolean): Uint8Array[] { const frames: Uint8Array[] = []; for (let i = 0; i < adts.length; ) { const length = ((adts[i + 3] & 0x03) << 11) | (adts[i + 4] << 3) | (adts[i + 5] >> 5); const header = adts[i + 1] & 0x01 ? 7 : 9; - frames.push(adts.subarray(i + header, i + length)); + frames.push(adts.subarray(i + (raw ? header : 0), i + length)); i += length; } return frames; @@ -51,45 +51,47 @@ test("the fallback decodes AAC without a native AudioDecoder", async () => { expect((await AudioDecoder.isConfigSupported({ ...config, codec })).supported).toBe(true); } - const planes: Float32Array[][] = [[], []]; - let failure: Error | undefined; - const decoder = new AudioDecoder({ - output: (data) => { - for (const [index, plane] of planes.entries()) { - const samples = new Float32Array(data.numberOfFrames); - data.copyTo(samples, { planeIndex: index, format: "f32-planar" }); - plane.push(samples); - } - data.close(); - }, - error: (error) => { - failure = error; - }, - }); - decoder.configure(config); - - const frames = rawFrames(new Uint8Array(await Bun.file(FIXTURE).arrayBuffer())); - for (const [index, data] of frames.entries()) { - decoder.decode( - new EncodedAudioChunk({ type: "key", timestamp: (index * 1024 * 1_000_000) / SAMPLE_RATE, data }), - ); - } - await decoder.flush(); - decoder.close(); - expect(failure).toBeUndefined(); + for (const raw of [true, false]) { + const planes: Float32Array[][] = [[], []]; + let failure: Error | undefined; + const decoder = new AudioDecoder({ + output: (data) => { + for (const [index, plane] of planes.entries()) { + const samples = new Float32Array(data.numberOfFrames); + data.copyTo(samples, { planeIndex: index, format: "f32-planar" }); + plane.push(samples); + } + data.close(); + }, + error: (error) => { + failure = error; + }, + }); + decoder.configure({ ...config, description: raw ? config.description : undefined }); - const [left, right] = planes.map((chunks) => { - const out = new Float32Array(chunks.reduce((sum, chunk) => sum + chunk.length, 0)); - let offset = 0; - for (const chunk of chunks) { - out.set(chunk, offset); - offset += chunk.length; + const frames = aacFrames(new Uint8Array(await Bun.file(FIXTURE).arrayBuffer()), raw); + for (const [index, data] of frames.entries()) { + decoder.decode( + new EncodedAudioChunk({ type: "key", timestamp: (index * 1024 * 1_000_000) / SAMPLE_RATE, data }), + ); } - return out; - }); - expect(left.length).toBe(frames.length * 1024); - expect(power(left, 440)).toBeGreaterThan(100 * power(left, 880)); - expect(power(right, 880)).toBeGreaterThan(100 * power(right, 440)); + await decoder.flush(); + decoder.close(); + expect(failure).toBeUndefined(); + + const [left, right] = planes.map((chunks) => { + const out = new Float32Array(chunks.reduce((sum, chunk) => sum + chunk.length, 0)); + let offset = 0; + for (const chunk of chunks) { + out.set(chunk, offset); + offset += chunk.length; + } + return out; + }); + expect(left.length).toBe(frames.length * 1024); + expect(power(left, 440)).toBeGreaterThan(100 * power(left, 880)); + expect(power(right, 880)).toBeGreaterThan(100 * power(right, 440)); + } }); // Runs on the polyfill's AudioData, which libopus decodes into. After the AAC test, which needs Bun's diff --git a/js/watch/src/audio/decoder.test.ts b/js/watch/src/audio/decoder.test.ts index 01b5e121d81..c8a006b4d4e 100644 --- a/js/watch/src/audio/decoder.test.ts +++ b/js/watch/src/audio/decoder.test.ts @@ -157,6 +157,8 @@ let decodeThrows: Error | undefined; let deferAudioOutput = false; let pendingAudio: (() => void)[] = []; let audioInputs: number[] = []; +let audioConfigs: AudioDecoderConfig[] = []; +let audioChunks: EncodedAudioChunkInit[] = []; beforeEach(() => { frameTimestamp = 0; @@ -166,6 +168,8 @@ beforeEach(() => { deferAudioOutput = false; pendingAudio = []; audioInputs = []; + audioConfigs = []; + audioChunks = []; contexts = []; worklets = []; moduleLoaded = Promise.resolve(); @@ -180,7 +184,8 @@ beforeEach(() => { codecErrors.push(init.error); codecs++; } - configure() { + configure(config: AudioDecoderConfig) { + audioConfigs.push(config); this.needsKey = true; } reset() { @@ -204,6 +209,7 @@ beforeEach(() => { readonly timestamp: number; readonly type: EncodedAudioChunkType; constructor(init: EncodedAudioChunkInit) { + audioChunks.push(init); this.timestamp = init.timestamp; this.type = init.type; } @@ -392,6 +398,30 @@ async function play(initial: Delay, buffered = false, cmaf = false) { }; } +for (const description of [undefined, "1190"]) { + it(`passes AAC to WebCodecs as ${description ? "raw" : "ADTS"}`, async () => { + const playback = await play(Milli(100)); + try { + playback.restore({ codec: "mp4a.40.2", sampleRate: 48_000, numberOfChannels: 2, description }); + await microtasks(); + const config = audioConfigs.at(-1); + expect(config?.codec).toBe("mp4a.40.2"); + expect(config?.description).toEqual(description ? new Uint8Array([0x11, 0x90]) : undefined); + const packet = new Uint8Array( + description ? [0x01, 0x52, 0xf2] : [0xff, 0xf1, 0x4c, 0x80, 0x01, 0x5f, 0xfc, 0x01, 0x52, 0xf2], + ); + const read = frame(); + read.frame.payload = packet; + playback.push(read); + await microtasks(); + expect(audioChunks.at(-1)?.data).toEqual(packet); + } finally { + playback.close(); + await microtasks(); + } + }); +} + for (const cmaf of [false, true]) { it(`a ${cmaf ? "CMAF" : "legacy"} gap releases accounting for codec outputs it discarded`, async () => { const clock = new Manual(); diff --git a/quest/m1/cut-audit/README.md b/quest/m1/cut-audit/README.md index 4f34f37e6ad..d14c29bcbbc 100644 --- a/quest/m1/cut-audit/README.md +++ b/quest/m1/cut-audit/README.md @@ -55,7 +55,6 @@ leaving JS-only redesigns of `js/net` to [rs2ts](/quest/m2/rs2ts-js.md). ## Required - [A reserved group survives a route returning](/quest/m1/cut-audit/reserved-route-return.md) - a route flip A to B to A no longer panics a peeked reader -- [A description-less AAC rendition means one thing](/quest/m1/cut-audit/aac-description-less.md) - every player and exporter agrees on the frame format - [Stream-accept loops yield on a per-poll budget](/quest/m1/cut-audit/accept-budget.md) - a peer opening many streams cannot monopolize a session driver - [Rust and JS skip a backlog by the same measure](/quest/m1/cut-audit/catalog-parity.md) - a backlog join starts at the same group in every player - [Text and data sections keep a prototype-named ID](/quest/m1/cut-audit/catalog-proto-ids.md) - text and data entries keep the ID JS's `z.record` drops diff --git a/quest/m1/cut-audit/aac-description-less.md b/quest/m1/cut-audit/aac-description-less.md deleted file mode 100644 index 8f0bc3161c6..00000000000 --- a/quest/m1/cut-audit/aac-description-less.md +++ /dev/null @@ -1,30 +0,0 @@ -# [S] A description-less AAC rendition means one thing everywhere - -## Goal - -An `mp4a.40.*` catalog entry with no `description` has one defined frame -format, written in the hang draft, and every player and exporter (JS watch, -moqsrc, moq-audio, TS export) decodes it the same way. - -## Plan - -Found by the 2026-10-24 pre-cut audit at 151a529670. Source-inferred and -spot-verified, inherited. - -Today `rs/moq-gst/src/source/imp.rs:1769` advertises `stream-format=adts`, -`js/watch/src/audio/decoder.ts:488` configures WebCodecs with no description -(which WebCodecs reads as ADTS), `rs/moq-audio/src/aac.rs:68` synthesizes an -AudioSpecificConfig and decodes the frames as raw, and -`rs/moq-mux/src/container/ts/export.rs:3823` treats them as raw and adds -ADTS headers. Whichever form a publisher sends, half the consumers break. - -Decided 2026-10-25 (maintainer): ADTS, matching WebCodecs, the browser -path most viewers use. moq-audio parses ADTS headers and TS export passes -the frames through. - -State the choice in `drafts/draft-lcurley-moq-hang.md` and add a test per -consumer with a description-less fixture. Check which first-party -publishers emit description-less AAC today, so none starts producing the -other form. - -Public API: none. Wire: a format clarification in the hang draft. diff --git a/rs/moq-audio/src/aac.rs b/rs/moq-audio/src/aac.rs index de7ff717dbe..1dab4c9efa5 100644 --- a/rs/moq-audio/src/aac.rs +++ b/rs/moq-audio/src/aac.rs @@ -45,9 +45,9 @@ fn validate(config: &moq_mux::codec::aac::Config) -> Result<(), Error> { /// The AudioSpecificConfig to open a decoder with, validated as AAC-LC. /// /// Prefers the catalog `description` verbatim, since re-encoding the parsed -/// fields would drop any extension it carries. A catalog without one (an MSF -/// track, or a producer that only filled in the plain fields) gets one -/// synthesized from the declared profile, rate, and channel count. +/// fields would drop any extension it carries. Without one, the decoder's config is +/// synthesized from the declared profile, rate, and channels. Legacy and LOC packets +/// then carry ADTS headers that must agree with it; CMAF samples remain raw. /// /// The profile is read back out of the resulting config rather than taken from /// the catalog codec string: the description is what the decoder acts on, and diff --git a/rs/moq-audio/src/decode/backend/symphonia.rs b/rs/moq-audio/src/decode/backend/symphonia.rs index e2a87c6253d..7bcc8ec448e 100644 --- a/rs/moq-audio/src/decode/backend/symphonia.rs +++ b/rs/moq-audio/src/decode/backend/symphonia.rs @@ -13,6 +13,7 @@ pub(super) struct Symphonia { inner: symphonia_codec_aac::AacDecoder, sample_rate: u32, layout: Layout, + adts: bool, } impl Symphonia { @@ -58,15 +59,32 @@ impl Symphonia { inner, sample_rate, layout: Layout::from_channels(channel_count as u32)?, + adts: catalog.description.is_none() && !matches!(catalog.container, hang::catalog::Container::Cmaf { .. }), })) } } impl Backend for Symphonia { fn decode(&mut self, packet: &[u8]) -> Result { - // The packet is a raw AAC frame, not ADTS, so there is nothing to timestamp - // it with here: the container carries the timestamp and the decoder only - // reads the payload. + let packet = if self.adts { + let header = + moq_mux::codec::aac::adts::Header::parse(packet).map_err(|err| Error::Decode(format!("aac: {err}")))?; + if header.object_type != 2 + || header.sample_rate != self.sample_rate + || u32::from(header.channel_config) != self.layout.channels() + || header.blocks != 1 + { + return Err(Error::Decode( + "ADTS header disagrees with the AAC-LC catalog or carries multiple blocks".into(), + )); + } + header + .payload(packet) + .map_err(|err| Error::Decode(format!("aac: {err}")))? + } else { + packet + }; + // The container carries the timestamp; Symphonia reads only the raw AAC block. let packet = symphonia_core::packet::PacketRef::new( 0, symphonia_core::units::Timestamp::ZERO, diff --git a/rs/moq-audio/src/decode/decoder.rs b/rs/moq-audio/src/decode/decoder.rs index 5ed9969e4d5..462981480fa 100644 --- a/rs/moq-audio/src/decode/decoder.rs +++ b/rs/moq-audio/src/decode/decoder.rs @@ -52,7 +52,8 @@ impl Decoder { /// `description` declares, refusing a malformed head; without a description /// it takes the catalog's channel count and applies neither. PCM uses the /// catalog fields directly and requires an absent `description`. AAC reads - /// its AudioSpecificConfig, synthesizing one from the catalog when absent. + /// its AudioSpecificConfig; without one, legacy and LOC packets carry ADTS headers, + /// while demuxed CMAF samples remain raw. pub fn new(catalog: &hang::catalog::AudioConfig, config: &Config) -> Result { let backend = backend::open(catalog, config)?; let delay = backend.delay(); @@ -198,13 +199,69 @@ pub(crate) mod tests { #[cfg(feature = "aac")] #[test] - fn aac_synthesizes_a_missing_description() { - // An MSF catalog carries the shape in its own fields instead. + fn aac_without_a_description_refuses_raw_packets() { let mut catalog = aac_catalog(); catalog.description = None; let mut decoder = Decoder::new(&catalog, &Config::default()).unwrap(); assert_eq!(decoder.sample_rate(), 44_100); + assert!(matches!(decoder.decode(AAC_FRAMES[0]), Err(Error::Decode(_)))); + } + + #[cfg(feature = "aac")] + #[test] + fn aac_without_a_description_decodes_adts() { + let mut catalog = aac_catalog(); + catalog.description = None; + for crc in [false, true] { + let mut adts = Decoder::new(&catalog, &Config::default()).unwrap(); + let mut raw = Decoder::new(&aac_catalog(), &Config::default()).unwrap(); + for frame in AAC_FRAMES { + let len = frame.len() + if crc { 9 } else { 7 }; + let mut packet = vec![ + 0xff, + if crc { 0xf0 } else { 0xf1 }, + 0x50, + 0x40 | (len >> 11) as u8, + (len >> 3) as u8, + ((len & 7) << 5) as u8 | 0x1f, + 0xfc, + ]; + if crc { + packet.extend_from_slice(&[0, 0]); + } + packet.extend_from_slice(frame); + let got = adts.decode(&packet).unwrap().samples; + let expected = raw.decode(frame).unwrap().samples; + assert!(got == expected, "ADTS framing changed decoded PCM"); + for altered in [2, 3, 6] { + let mut invalid = packet.clone(); + invalid[altered] ^= if altered == 2 { + 4 + } else if altered == 3 { + 0xc0 + } else { + 1 + }; + assert!(matches!(adts.decode(&invalid), Err(Error::Decode(_)))); + } + assert!(matches!( + adts.decode(&packet[..packet.len() - 1]), + Err(Error::Decode(_)) + )); + } + } + } + + #[cfg(feature = "aac")] + #[test] + fn cmaf_aac_samples_remain_raw_without_a_catalog_description() { + let mut catalog = aac_catalog(); + catalog.description = None; + catalog.container = hang::catalog::Container::Cmaf { + init: bytes::Bytes::new(), + }; + let mut decoder = Decoder::new(&catalog, &Config::default()).unwrap(); assert_eq!(decoder.decode(AAC_FRAMES[0]).unwrap().samples.len(), 1024); } diff --git a/rs/moq-gst/src/source/imp.rs b/rs/moq-gst/src/source/imp.rs index 99042ec42ed..dbce6cb252e 100644 --- a/rs/moq-gst/src/source/imp.rs +++ b/rs/moq-gst/src/source/imp.rs @@ -1977,7 +1977,7 @@ fn audio_caps(config: &hang::catalog::AudioConfig) -> Result { if let Some(description) = &config.description { builder = builder .field("codec_data", gst::Buffer::from_slice(description.clone())) - .field("stream-format", "aac"); + .field("stream-format", "raw"); } else { builder = builder.field("stream-format", "adts"); } @@ -2103,6 +2103,22 @@ mod tests { } } + #[test] + fn aac_caps_follow_the_description_framing() { + gst::init().unwrap(); + for description in [None, Some(bytes::Bytes::from_static(&[0x12, 0x08]))] { + let mut config = hang::catalog::AudioConfig::new(hang::catalog::AAC { profile: 2 }, 44_100, 1); + config.description = description.clone(); + let caps = super::audio_caps(&config).unwrap(); + let structure = caps.structure(0).unwrap(); + assert_eq!( + structure.get::("stream-format").unwrap(), + if description.is_some() { "raw" } else { "adts" } + ); + assert_eq!(structure.has_field("codec_data"), description.is_some()); + } + } + /// opusdec's templates require the mapping fields as ints, so decodebin finds no decoder without them. #[test] fn opus_caps_carry_the_stream_layout() { diff --git a/rs/moq-mux/src/container/ts/adts.rs b/rs/moq-mux/src/codec/aac/adts.rs similarity index 58% rename from rs/moq-mux/src/container/ts/adts.rs rename to rs/moq-mux/src/codec/aac/adts.rs index 632947bdce4..57e11967d89 100644 --- a/rs/moq-mux/src/container/ts/adts.rs +++ b/rs/moq-mux/src/codec/aac/adts.rs @@ -7,33 +7,58 @@ use anyhow::Context; -/// ISO 14496-3 sampling-frequency-index table. -const SAMPLE_RATES: [u32; 13] = [ - 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350, -]; +use super::SAMPLE_RATES; + +/// An invalid ADTS header or frame. +#[derive(Clone, Debug, PartialEq, Eq, thiserror::Error)] +#[non_exhaustive] +pub enum Error { + /// The fixed header is incomplete. + #[error("ADTS header truncated")] + Truncated, + /// The header does not start with an ADTS syncword. + #[error("missing ADTS syncword")] + Syncword, + /// The header names a reserved sample rate. + #[error("reserved ADTS sample rate index")] + SampleRate, + /// The declared frame cannot contain its header. + #[error("ADTS frame length smaller than its header")] + FrameLength, + /// A packet does not contain exactly one complete ADTS frame. + #[error("ADTS packet must contain exactly one complete frame")] + PacketLength, +} /// Bytes needed to attempt a header parse: the fixed header without a CRC. -pub(super) const MIN_HEADER_LEN: usize = 7; +pub(crate) const MIN_HEADER_LEN: usize = 7; /// Fields decoded from an ADTS fixed+variable header. #[derive(Clone, Copy, Debug)] -pub(super) struct Header { +pub struct Header { /// audioObjectType (ADTS `profile` + 1). AAC-LC is 2. pub object_type: u8, + /// The sampling rate signaled by the ADTS core. pub sample_rate: u32, /// channelConfiguration; 0 means a program config element in the raw data block describes the channels. pub channel_config: u8, /// Total access-unit length, header included. - pub frame_len: usize, - /// Header length: 7 without CRC, 9 with. - pub header_len: usize, + pub(crate) frame_len: usize, + /// The number of raw AAC blocks carried by this frame. + pub blocks: u8, + /// Header length, including CRC and raw-block position fields when present. + pub(crate) header_len: usize, } impl Header { /// Parse the ADTS header at the start of `data`. - pub fn parse(data: &[u8]) -> anyhow::Result { - anyhow::ensure!(data.len() >= MIN_HEADER_LEN, "ADTS header truncated"); - anyhow::ensure!(data[0] == 0xFF && (data[1] & 0xF0) == 0xF0, "missing ADTS syncword"); + pub fn parse(data: &[u8]) -> Result { + if data.len() < MIN_HEADER_LEN { + return Err(Error::Truncated); + } + if data[0] != 0xFF || data[1] & 0xF6 != 0xF0 { + return Err(Error::Syncword); + } let protection_absent = data[1] & 0x01; let profile = (data[2] >> 6) & 0x03; @@ -45,22 +70,37 @@ impl Header { let sample_rate = SAMPLE_RATES .get(freq_index as usize) .copied() - .context("reserved ADTS sample rate index")?; - let header_len = if protection_absent == 1 { 7 } else { 9 }; - anyhow::ensure!(frame_len >= header_len, "ADTS frame length smaller than its header"); + .ok_or(Error::SampleRate)?; + let blocks = 1 + (data[6] & 3); + let header_len = if protection_absent == 1 { + 7 + } else { + 7 + 2 * usize::from(blocks) + }; + if frame_len < header_len { + return Err(Error::FrameLength); + } Ok(Self { object_type: profile + 1, sample_rate, channel_config, frame_len, + blocks, header_len, }) } + /// Borrow the payload after the header of one complete ADTS frame. + pub fn payload<'a>(&self, packet: &'a [u8]) -> Result<&'a [u8], Error> { + if packet.len() != self.frame_len || self.header_len > packet.len() { + return Err(Error::PacketLength); + } + Ok(&packet[self.header_len..]) + } } /// Build a 7-byte ADTS header (no CRC) for a raw AAC frame of `raw_len` bytes. -pub(super) fn write_header( +pub(crate) fn write_header( object_type: u8, sample_rate: u32, channel_config: u8, @@ -105,16 +145,6 @@ fn freq_index_from_rate(sample_rate: u32) -> anyhow::Result { .with_context(|| format!("sample rate {sample_rate} not representable in ADTS")) } -/// Map a channel count to the ADTS `channel_config` (ISO 14496-3 Table 1.19) naming it, refusing a -/// count that none does rather than guess a layout. -pub(super) fn channel_config_from_count(channel_count: u32) -> anyhow::Result { - match channel_count { - 1..=6 => Ok(channel_count as u8), - 8 => Ok(7), - _ => anyhow::bail!("{channel_count} channels have no ADTS channelConfiguration"), - } -} - #[cfg(test)] mod tests { use super::*; @@ -150,14 +180,6 @@ mod tests { } } - #[test] - fn channel_counts_without_a_configuration_are_refused() { - assert_eq!(channel_config_from_count(8).unwrap(), 7); - for count in [0, 7, 9, 24] { - assert!(channel_config_from_count(count).is_err()); - } - } - #[test] fn frame_len_for_5_1() { let header = write_header(2, 44_100, 6, 512).unwrap(); @@ -166,4 +188,47 @@ mod tests { assert_eq!(parsed.sample_rate, 44_100); assert_eq!(parsed.frame_len, 519); } + + #[test] + fn a_packet_holds_one_whole_frame_including_its_crc() { + for crc in [false, true] { + let mut packet = write_header(2, 44_100, 1, 3 + usize::from(crc) * 2).unwrap().to_vec(); + if crc { + packet[1] &= !1; + packet.extend_from_slice(&[0, 0]); + } + packet.extend_from_slice(&[1, 2, 3]); + let header = Header::parse(&packet).unwrap(); + assert_eq!(header.payload(&packet).unwrap(), [1, 2, 3]); + for end in 0..packet.len() { + assert!(header.payload(&packet[..end]).is_err()); + } + packet.push(0); + assert!( + header.payload(&packet).is_err(), + "trailing bytes are not part of the frame" + ); + } + } + + #[test] + fn an_adts_syncword_has_zero_layer_bits() { + let mut packet = write_header(2, 44_100, 1, 1).unwrap(); + for layer in 1..=3 { + packet[1] = 0xf1 | layer << 1; + assert!(matches!(Header::parse(&packet), Err(Error::Syncword))); + } + } + + #[test] + fn protected_multi_block_frames_keep_their_position_table_in_the_header() { + let mut packet = write_header(2, 44_100, 1, 11).unwrap().to_vec(); + packet[1] &= !1; + packet[6] |= 3; + packet.extend_from_slice(&[0; 8]); + packet.extend_from_slice(&[1, 2, 3]); + let header = Header::parse(&packet).unwrap(); + assert_eq!(header.blocks, 4); + assert_eq!(header.payload(&packet).unwrap(), [1, 2, 3]); + } } diff --git a/rs/moq-mux/src/codec/aac/import.rs b/rs/moq-mux/src/codec/aac/import.rs index 4fc34784137..9ff8cfe426d 100644 --- a/rs/moq-mux/src/codec/aac/import.rs +++ b/rs/moq-mux/src/codec/aac/import.rs @@ -28,6 +28,11 @@ impl Import { reserved: crate::catalog::Reserved, config: hang::catalog::AudioConfig, ) -> crate::Result { + if config.description.is_none() { + let err = crate::Error::from(super::Error::MissingDescription); + track.abort(err.reason())?; + return Err(err); + } tracing::debug!(name = ?track.name(), ?config, "starting track"); // The caller's config names the container; the writer is built from that same value so the // wire cannot disagree with what the rendition advertises. @@ -145,3 +150,26 @@ fn catalog_config(config: &Config) -> hang::catalog::AudioConfig { audio.container = hang::catalog::Container::Legacy; audio } + +#[cfg(test)] +mod tests { + #[tokio::test(start_paused = true)] + async fn raw_publication_needs_a_description_before_advertising() { + let mut broadcast = moq_net::broadcast::Info::new().produce(); + let catalog = crate::catalog::Producer::new(&mut broadcast, crate::catalog::Config::default()).unwrap(); + let track = broadcast + .create_track("audio", hang::container::track_info(hang::catalog::PRIORITY.audio)) + .unwrap(); + let mut subscriber = track.subscribe(None); + let config = hang::catalog::AudioConfig::new(hang::catalog::AAC { profile: 2 }, 48_000, 2); + assert!(matches!( + super::Import::new(track, catalog.reserve(), config), + Err(crate::Error::Aac(super::super::Error::MissingDescription)) + )); + assert!(catalog.snapshot().audio.renditions.is_empty()); + assert!(matches!( + subscriber.poll_finished(&kio::Waiter::noop()), + std::task::Poll::Ready(Err(_)) + )); + } +} diff --git a/rs/moq-mux/src/codec/aac/mod.rs b/rs/moq-mux/src/codec/aac/mod.rs index f01b4036b4c..b11cb599fdc 100644 --- a/rs/moq-mux/src/codec/aac/mod.rs +++ b/rs/moq-mux/src/codec/aac/mod.rs @@ -3,6 +3,9 @@ //! ISO 14496-3 AudioSpecificConfig parse and encode lives in [`Config`]. //! [`Import`] publishes raw AAC frames (not ADTS) to a moq broadcast. +/// ADTS framing for AAC packets without an AudioSpecificConfig. +pub mod adts; + mod import; pub use import::*; @@ -61,6 +64,10 @@ pub enum Error { /// The program config element declares zero channels. #[error("program config element declares no channels")] ProgramConfigEmpty, + + /// Raw AAC publication needs an AudioSpecificConfig in the catalog. + #[error("raw AAC publication requires an AudioSpecificConfig description")] + MissingDescription, } /// A result using this module's error type. diff --git a/rs/moq-mux/src/container/ts/export.rs b/rs/moq-mux/src/container/ts/export.rs index 26204530a82..67eb50234d6 100644 --- a/rs/moq-mux/src/container/ts/export.rs +++ b/rs/moq-mux/src/container/ts/export.rs @@ -600,6 +600,10 @@ impl Track { fn samples(&self, payload: &[u8]) -> Option<(u64, u32)> { let parse = match &self.kind { Kind::Aac { config, .. } => return (config.sample_rate > 0).then_some((1024, config.sample_rate)), + Kind::Adts { .. } => { + let header = adts::Header::parse(payload).ok()?; + return Some((1024 * u64::from(header.blocks), header.sample_rate)); + } Kind::Mp2 { .. } => crate::codec::mp2::parse_header, Kind::Ac3 => crate::codec::ac3::parse_header, Kind::Eac3 => crate::codec::eac3::parse_header, @@ -938,6 +942,14 @@ enum Kind { /// element, which leads the first raw data block after each PAT/PMT, so a receiver that tunes /// in at the tables can decode from there. `repeat` marks that the next frame carries it. Aac { config: aac::InBand, repeat: bool }, + /// Description-less AAC carries its ADTS framing in each frame, so frames pass through as + /// they are. The catalog's profile, rate, and channels are kept only so [`Export::rebind`] + /// refuses a rendition announced differently, as it does for [`Kind::Aac`]'s config. + Adts { + profile: u8, + sample_rate: u32, + channels: u32, + }, /// Opus (private stream_type 0x06). Each frame is one Opus packet, prefixed with /// the Opus-in-TS access-unit control header and announced with the 'Opus' /// registration plus DVB extension descriptor. `channel_config_code` is a plain @@ -963,7 +975,7 @@ impl Kind { fn stream_type(&self) -> u8 { match self { Kind::Video(stream_type) => *stream_type as u8, - Kind::Aac { .. } => StreamType::AdtsAac as u8, + Kind::Aac { .. } | Kind::Adts { .. } => StreamType::AdtsAac as u8, // Opus rides private-data PES; the registration + extension descriptors tell the // demuxer it's Opus. Kind::Opus { .. } => 0x06, @@ -1001,7 +1013,7 @@ impl Kind { match self { Kind::Video(StreamType::H265) => ".hev1", Kind::Video(_) => ".avc3", - Kind::Aac { .. } => ".aac", + Kind::Aac { .. } | Kind::Adts { .. } => ".aac", Kind::Opus { .. } => ".opus", Kind::Mp2 { .. } => ".mp2", Kind::Ac3 => ".ac3", @@ -1019,7 +1031,7 @@ impl Kind { | Kind::PesPacket { stream_type: 0x01 | 0x02, } => super::stats::Class::Video, - Kind::Aac { .. } | Kind::Opus { .. } | Kind::Mp2 { .. } | Kind::Ac3 | Kind::Eac3 => { + Kind::Aac { .. } | Kind::Adts { .. } | Kind::Opus { .. } | Kind::Mp2 { .. } | Kind::Ac3 | Kind::Eac3 => { super::stats::Class::Audio } Kind::Verbatim { .. } | Kind::PesPacket { .. } => super::stats::Class::Data, @@ -3056,7 +3068,10 @@ where tracks.iter().find(|t| { matches!( t.kind, - Kind::Aac { .. } | Kind::Opus { .. } | Kind::Mp2 { .. } | Kind::Ac3 | Kind::Eac3 + Kind::Aac { .. } + | Kind::Adts { .. } | Kind::Opus { .. } + | Kind::Mp2 { .. } | Kind::Ac3 + | Kind::Eac3 ) }) }) @@ -4404,7 +4419,7 @@ fn audio_buffer(config: &AudioConfig, kind: &Kind) -> Buffer { _ => (33_177_600, 51_216), }; let (rate, size) = match kind { - Kind::Aac { .. } | Kind::Opus { .. } => by_channels(), + Kind::Aac { .. } | Kind::Adts { .. } | Kind::Opus { .. } => by_channels(), Kind::Mp2 { .. } => (2_000_000, 3_584), // ATSC A/53 Part 5 5.7, and A/52 Annex G 3.6.1 for E-AC-3. Kind::Ac3 => (2_000_000, 2_592), @@ -4553,6 +4568,12 @@ fn es_payload(kind: &Kind, description: Option<&Bytes>, frame: &Frame, pce: bool framed.extend_from_slice(&frame.payload); Some(framed) } + Kind::Adts { .. } => { + let header = adts::Header::parse(&frame.payload)?; + header.payload(&frame.payload)?; + // ADTS names the core; the catalog may name SBR's output rate and channels. + Some(frame.payload.to_vec()) + } // Each moq Opus frame is one packet; prefix the Opus-in-TS control header. Kind::Opus { .. } => Some(opus_es_payload(&frame.payload)), // Legacy audio frames were ingested whole (framing header included), so @@ -4685,17 +4706,15 @@ fn audio_kind(config: &AudioConfig, name: &str) -> anyhow::Result { ensure_raw(&config.container, "audio", name)?; match &config.codec { AudioCodec::AAC(codec) => { - // The description is exact, and names the LC core under explicit SBR or PS. Without - // one, the catalog is all there is. - let in_band = match &config.description { - Some(asc) => aac::in_band(asc)?, - None => aac::InBand { - object_type: codec.profile, + let Some(asc) = &config.description else { + return Ok(Kind::Adts { + profile: codec.profile, sample_rate: config.sample_rate, - channel_config: adts::channel_config_from_count(config.channel_count)?, - program_config: None, - }, + channels: config.channel_count, + }); }; + // The description names the LC core under explicit SBR or PS. + let in_band = aac::in_band(asc)?; // A rebuilt kind repeats the element too, so a catalog update between a PAT/PMT and // this track's next frame cannot drop it. Ok(Kind::Aac { @@ -5071,6 +5090,21 @@ mod tests { Timestamp::from_millis(value).unwrap() } + #[test] + fn aac_without_a_description_preserves_adts() { + let config = hang::catalog::AudioConfig::new(hang::catalog::AAC { profile: 2 }, 44_100, 1); + let kind = super::audio_kind(&config, "audio").unwrap(); + let mut packet = super::adts::write_header(2, 44_100, 1, 3).unwrap().to_vec(); + packet.extend_from_slice(&[0x01, 0x52, 0xf2]); + let frame = super::Frame { + timestamp: ms(0), + payload: packet.clone().into(), + keyframe: true, + duration: None, + }; + assert_eq!(super::es_payload(&kind, None, &frame, true).unwrap().unwrap(), packet); + } + #[test] fn video_es_payload_keeps_aud_first() { for (stream_type, params, aud, slice) in [ diff --git a/rs/moq-mux/src/container/ts/export_test.rs b/rs/moq-mux/src/container/ts/export_test.rs index 5ec8bceba7e..062a8e7d066 100644 --- a/rs/moq-mux/src/container/ts/export_test.rs +++ b/rs/moq-mux/src/container/ts/export_test.rs @@ -170,6 +170,7 @@ async fn custom_selected_catalog_drives_export_and_follow() { .create_track(name, hang::container::track_info(hang::catalog::PRIORITY.audio)) .unwrap(); let mut config = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + config.description = Some(Bytes::from_static(&[0x11, 0x90])); config.container = Container::Legacy; snapshot.audio.renditions.insert(name.into(), config); let mut producer = Producer::new(track, HangContainer::Legacy(Kind::Data)); @@ -295,6 +296,7 @@ async fn export_aac_roundtrip() { let name = track.name().to_string(); { let mut cfg = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + cfg.description = Some(Bytes::from_static(&[0x11, 0x90])); cfg.container = Container::Legacy; catalog.modify().unwrap().audio.renditions.insert(name.clone(), cfg); } @@ -376,6 +378,7 @@ async fn export_skips_a_disabled_rendition() { ) .unwrap(); let mut cfg = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + cfg.description = Some(Bytes::from_static(&[0x11, 0x90])); cfg.container = Container::Legacy; cfg.enabled = enabled; catalog @@ -439,6 +442,7 @@ async fn export_packs_aac_frames_up_to_their_buffer() { let name = track.name().to_string(); { let mut cfg = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + cfg.description = Some(Bytes::from_static(&[0x11, 0x90])); cfg.container = Container::Legacy; catalog.modify().unwrap().audio.renditions.insert(name.clone(), cfg); } @@ -592,6 +596,7 @@ async fn export_lead_audio() -> BytesMut { .unwrap(); { let mut cfg = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + cfg.description = Some(Bytes::from_static(&[0x11, 0x90])); cfg.container = Container::Legacy; catalog .modify() @@ -1114,6 +1119,7 @@ async fn export_resumes_whole_mpeg2_video_at_a_sequence_header() { ) .unwrap(); let mut aac = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + aac.description = Some(Bytes::from_static(&[0x11, 0x90])); aac.container = Container::Legacy; let track = broadcast .create_track("audio", hang::container::track_info(hang::catalog::PRIORITY.audio)) @@ -1490,6 +1496,7 @@ async fn export_pcr_wraps_below_zero_at_start() { .unwrap(); { let mut cfg = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + cfg.description = Some(Bytes::from_static(&[0x11, 0x90])); cfg.container = Container::Legacy; catalog .modify() @@ -2835,12 +2842,10 @@ async fn aac_explicit_sbr_exports_its_lc_core() { } } -/// Without a description, the catalog is all ADTS has to label a track with. A channel count no -/// channelConfiguration names is refused rather than written as stereo, and HE-AAC, whose core -/// rate and layout only a description names, is refused rather than masked to AAC Main. +/// A description-less catalog selects ADTS, so raw AAC is refused before it can be mislabeled. #[tokio::test(start_paused = true)] -async fn aac_export_refuses_what_adts_cannot_label() { - for (profile, channel_count, refusal) in [(2, 7, "7 channels"), (5, 2, "audioObjectType 5")] { +async fn description_less_aac_refuses_raw_payloads() { + for (profile, channel_count, refusal) in [(2, 7, "ADTS header truncated"), (5, 2, "ADTS header truncated")] { let mut broadcast = moq_net::broadcast::Info::new().produce(); let consumer = broadcast.consume(); let mut catalog = crate::catalog::Producer::new(&mut broadcast, crate::catalog::Config::default()).unwrap(); @@ -3967,6 +3972,7 @@ async fn export_rejects_si_pid_on_the_pmt() { let name = track.name().to_string(); { let mut cfg = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + cfg.description = Some(Bytes::from_static(&[0x11, 0x90])); cfg.container = Container::Legacy; let mut guard = catalog.modify().unwrap(); guard.audio.renditions.insert(name, cfg); @@ -4024,6 +4030,7 @@ async fn export_rejects_si_pid_on_an_elementary_stream() { let name = track.name().to_string(); { let mut cfg = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + cfg.description = Some(Bytes::from_static(&[0x11, 0x90])); cfg.container = Container::Legacy; let mut guard = catalog.modify().unwrap(); guard.audio.renditions.insert(name.clone(), cfg); @@ -4121,6 +4128,7 @@ async fn discontinuity_re_emits_tables_and_resumes_the_clock() { { let mut guard = catalog.modify().unwrap(); let mut cfg = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + cfg.description = Some(Bytes::from_static(&[0x11, 0x90])); cfg.container = Container::Legacy; guard.audio.renditions.insert(name, cfg); } @@ -4318,6 +4326,8 @@ async fn discontinuity_flags_the_break_once_across_tracks() { guard.video.renditions.insert(video_track.name().to_string(), video); let mut audio = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + + audio.description = Some(Bytes::from_static(&[0x11, 0x90])); audio.container = Container::Legacy; guard.audio.renditions.insert(audio_track.name().to_string(), audio); } @@ -5644,6 +5654,7 @@ async fn export_twice(with_video: bool) -> (Vec, Vec) { ) .unwrap(); let mut cfg = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + cfg.description = Some(Bytes::from_static(&[0x11, 0x90])); cfg.container = Container::Legacy; catalog .modify() @@ -5859,6 +5870,7 @@ impl Interleave { ) .unwrap(); let mut cfg = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + cfg.description = Some(Bytes::from_static(&[0x11, 0x90])); cfg.container = Container::Legacy; catalog .modify() @@ -7671,6 +7683,7 @@ async fn export_refuses_an_absurd_catalog_mux_rate() { let name = track.name().to_string(); catalog.modify().unwrap().audio.renditions.insert(name.clone(), { let mut cfg = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + cfg.description = Some(Bytes::from_static(&[0x11, 0x90])); cfg.container = Container::Legacy; cfg }); @@ -7726,6 +7739,7 @@ async fn export_pcr_is_its_byte_position_at_the_rate() { let name = track.name().to_string(); { let mut cfg = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + cfg.description = Some(Bytes::from_static(&[0x11, 0x90])); cfg.container = Container::Legacy; catalog.modify().unwrap().audio.renditions.insert(name.clone(), cfg); } @@ -7831,6 +7845,7 @@ impl Reordered { ) .unwrap(); let mut cfg = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + cfg.description = Some(Bytes::from_static(&[0x11, 0x90])); cfg.container = Container::Legacy; catalog .modify() @@ -8239,6 +8254,7 @@ async fn a_skipped_group_keeps_the_clock() { .unwrap(); { let mut cfg = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + cfg.description = Some(Bytes::from_static(&[0x11, 0x90])); cfg.container = Container::Legacy; catalog .modify() @@ -8303,6 +8319,7 @@ async fn a_timeline_restarting_at_zero_fails_the_export() { .unwrap(); { let mut cfg = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + cfg.description = Some(Bytes::from_static(&[0x11, 0x90])); cfg.container = Container::Legacy; catalog .modify() @@ -8404,6 +8421,7 @@ fn aac_rendition( .create_track(name, hang::container::track_info(hang::catalog::PRIORITY.audio)) .unwrap(); let mut cfg = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + cfg.description = Some(Bytes::from_static(&[0x11, 0x90])); cfg.container = Container::Legacy; catalog.modify().unwrap().audio.renditions.insert(name.to_string(), cfg); Producer::new(track, HangContainer::Legacy(crate::container::Kind::Data)) @@ -8587,6 +8605,7 @@ async fn a_rendition_moved_to_another_aac_configuration_fails() { let config = guard.audio.renditions.get_mut("main").unwrap(); config.track = Some("next".to_string()); config.sample_rate = 44_100; + config.description = Some(Bytes::from_static(&[0x12, 0x10])); } write_aac(&mut next, 200); let err = kio::clock::timeout(DRAIN, async { @@ -9368,7 +9387,7 @@ async fn large_pmt(streams: u16, mux_rate: Option) -> usize { .unwrap() .audio .renditions - .insert(name.clone(), AudioConfig::new(AAC { profile: 2 }, 48_000, 2)); + .insert(name.clone(), crate::codec::aac::config(&[0x11, 0x90]).unwrap()); let mut entry = tscat::Track::new(0x1001 + index); entry.descriptors = vec![tscat::Descriptor { tag: 0x0a, @@ -10757,6 +10776,8 @@ async fn export_placed(placed: Placed) -> crate::Result> { } let mut aac = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + + aac.description = Some(Bytes::from_static(&[0x11, 0x90])); aac.container = Container::Legacy; let track = broadcast .create_track( diff --git a/rs/moq-mux/src/container/ts/export_timing_test.rs b/rs/moq-mux/src/container/ts/export_timing_test.rs index bc447f94865..4d39e22c855 100644 --- a/rs/moq-mux/src/container/ts/export_timing_test.rs +++ b/rs/moq-mux/src/container/ts/export_timing_test.rs @@ -129,6 +129,7 @@ impl Live { ) .unwrap(); let mut cfg = AudioConfig::new(AAC { profile: 2 }, 48_000, 2); + cfg.description = Some(Bytes::from_static(&[0x11, 0x90])); cfg.container = Container::Legacy; catalog .modify() diff --git a/rs/moq-mux/src/container/ts/import.rs b/rs/moq-mux/src/container/ts/import.rs index 3b1ba1e2c7b..621832497f7 100644 --- a/rs/moq-mux/src/container/ts/import.rs +++ b/rs/moq-mux/src/container/ts/import.rs @@ -3823,10 +3823,12 @@ impl AacStream { // the next PES extends the buffer, rather than trusting it now. break; } else { - adts::Header::parse(&data[end..]).map(|_| (header, end)).map_err(Some) + adts::Header::parse(&data[end..]) + .map(|_| (header, end)) + .map_err(|err| Some(err.into())) } } - Err(err) => Err(Some(err)), + Err(err) => Err(Some(err.into())), }; let (header, end) = match parsed { @@ -7305,8 +7307,7 @@ pub(super) mod test { // The AAC counterpart of the above. Worth its own test rather than trusting the shared // `Resync`: this path scans for the ADTS sync byte rather than a descriptor's, and - // builds its give-up error by adding context to the `anyhow` one `adts::Header::parse` - // returns, where the legacy path wraps a `thiserror` value. + // builds its give-up error from the one `adts::Header::parse` returns. #[test] fn aac_gives_up_when_nothing_ever_parses() { const AAC_PID: u16 = 0x0060; diff --git a/rs/moq-mux/src/container/ts/mod.rs b/rs/moq-mux/src/container/ts/mod.rs index c6b278b52cc..0b5c51fe5b4 100644 --- a/rs/moq-mux/src/container/ts/mod.rs +++ b/rs/moq-mux/src/container/ts/mod.rs @@ -23,7 +23,7 @@ //! demultiplexing cannot carry (TS-level scrambling, PSI and SI as authored), and //! [`Release`] writes that track back out on a fixed delay. -mod adts; +use crate::codec::aac::adts; mod damage; mod demux; mod export; diff --git a/rs/moq-mux/src/container/ts/revision_test.rs b/rs/moq-mux/src/container/ts/revision_test.rs index 3e8d00750b8..624b6eea09c 100644 --- a/rs/moq-mux/src/container/ts/revision_test.rs +++ b/rs/moq-mux/src/container/ts/revision_test.rs @@ -635,6 +635,7 @@ fn aac_track( .unwrap(); let name = track.name().to_string(); let mut config = hang::catalog::AudioConfig::new(hang::catalog::AAC { profile: 2 }, 48_000, 2); + config.description = Some(bytes::Bytes::from_static(&[0x11, 0x90])); config.container = hang::catalog::Container::Legacy; let mut guard = catalog.modify().unwrap(); guard.audio.renditions.insert(name.clone(), config); diff --git a/rs/moq-srt/src/server.rs b/rs/moq-srt/src/server.rs index d5f12b01665..e34022f2769 100644 --- a/rs/moq-srt/src/server.rs +++ b/rs/moq-srt/src/server.rs @@ -926,6 +926,7 @@ mod tests { { let mut guard = catalog.modify().unwrap(); let mut config = hang::catalog::AudioConfig::new(hang::catalog::AAC { profile: 2 }, 48_000, 2); + config.description = Some(Bytes::from_static(&[0x11, 0x90])); config.container = hang::catalog::Container::Legacy; guard.audio.renditions.insert(track.name().to_string(), config); } @@ -1032,6 +1033,7 @@ mod tests { .create_track(track, hang::container::track_info(hang::catalog::PRIORITY.audio)) .unwrap(); let mut config = hang::catalog::AudioConfig::new(hang::catalog::AAC { profile: 2 }, 48_000, 2); + config.description = Some(Bytes::from_static(&[0x11, 0x90])); config.container = hang::catalog::Container::Legacy; catalog .modify()