Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion quest/m2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ ranked just below deterministic TS legs, which it requires.
- [Watch decode gate](/quest/m2/watch-decode-gate.md) - video lookahead stays encoded until it is near presentation, like audio
- [Deterministic TS legs](/quest/m2/ts-hitless.md) - two `--sync` legs of one broadcast render every common slot identically, continuity counters included, through complementary loss
- [TS over RTP legs](/quest/m2/ts-rtp-egress.md) - two legs send identical RTP packets, headers included, so an ST 2022-7 receiver can merge them
- [DVB E-AC-3](/quest/m2/ts-eac3.md) - E-AC-3 private data is split per access unit (independent frame plus its dependent substreams) and buffer-modelled in TS export
- [moqsrc A/V sync](/quest/m2/moqsrc-av-sync.md) - a nightly test measures A/V skew from `moqsrc` through clock-synced sinks
- [MP4 export](/quest/m2/mp4-export.md) - `moq export mp4 --output` records crash-safe fragments, then finishes a regular MP4 with moov at the end
- [fMP4 edit lists](/quest/m2/fmp4-edit-lists.md) - the fMP4 importer applies edit lists to frame timestamps
Expand Down
29 changes: 0 additions & 29 deletions quest/m2/ts-eac3.md

This file was deleted.

39 changes: 26 additions & 13 deletions rs/moq-mux/src/codec/eac3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,31 @@ const CHANNELS: [u32; 8] = [2, 1, 2, 3, 3, 4, 4, 5];

/// Parse an E-AC-3 sync frame header from the start of `data` (needs >= 6 bytes).
pub(crate) fn parse_header(data: &[u8]) -> legacy::Result<legacy::Header> {
let header = sync_header(data)?;
// A dependent substream (strmtyp 1) extends a prior program to 7.1+, and a
// nonzero substreamid carries additional programs in the same PID. Either
// would make this track's channel count a lie, so they are rejected rather
// than mis-described.
let strmtyp = data[2] >> 6;
if strmtyp == 1 {
return Err(legacy::Error::Eac3DependentSubstream);
}
let substreamid = (data[2] >> 3) & 0x07;
if substreamid != 0 {
return Err(legacy::Error::Eac3AdditionalSubstream(substreamid));
}
Ok(header)
}

/// Whether the sync frame at the start of `data` (needs >= 3 bytes) begins an access unit:
/// independent substream 0, which every substream after it until the next one extends
/// (ETSI TS 102 366 E.1.3.1.2).
pub(crate) fn begins_unit(data: &[u8]) -> bool {
data[2] >> 6 != 1 && (data[2] >> 3) & 0x07 == 0
}

/// Parse a sync frame's bounds and duration without assigning its substream to an audio track.
pub(crate) fn sync_header(data: &[u8]) -> legacy::Result<legacy::Header> {
if data.len() < 6 {
return Err(legacy::Error::Eac3HeaderTooShort);
}
Expand All @@ -42,21 +67,9 @@ pub(crate) fn parse_header(data: &[u8]) -> legacy::Result<legacy::Header> {
return Err(legacy::Error::Eac3NotEac3Bsid(bsid));
}

// A dependent substream (strmtyp 1) extends a prior program to 7.1+, and a
// nonzero substreamid carries additional programs in the same PID. Either
// would make this track's channel count a lie, so they are rejected rather
// than mis-described.
let strmtyp = data[2] >> 6;
if strmtyp == 3 {
if data[2] >> 6 == 3 {
return Err(legacy::Error::Eac3ReservedStreamType);
}
if strmtyp == 1 {
return Err(legacy::Error::Eac3DependentSubstream);
}
let substreamid = (data[2] >> 3) & 0x07;
if substreamid != 0 {
return Err(legacy::Error::Eac3AdditionalSubstream(substreamid));
}

let frmsiz = (((data[2] & 0x07) as usize) << 8) | data[3] as usize;
let len = (frmsiz + 1) * 2;
Expand Down
Loading
Loading