Skip to content
Closed
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
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ zeroize = { version = "1", features = ["derive"] }
# this, the lock carries a second kio whose pin drifts behind the member, and the
# next publish that reaches both fails to resolve a single version (#3551).
kio = { path = "rs/kio" }
# TEMP: carries the dOps channel mapping until kixelated/mp4-atom#246 releases.
mp4-atom = { git = "https://github.com/kixelated/mp4-atom", branch = "dops-channel-mapping" }

[profile.dev]
# Full DWARF is what makes a debug build enormous: the debug `libmoq_ffi.a`
Expand Down
1 change: 0 additions & 1 deletion quest/m2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ ranked just below deterministic TS legs, which it requires.
- [MoQ in obs-studio](/quest/m2/obs-studio/README.md) - a native MoQ output and service merged into obs-studio, once its maintainers agree; the plugin carries it until then
- [AudioToolbox decode](/quest/m2/audio-decode-audiotoolbox.md) - macOS and iOS decode HE-AAC, multichannel AAC, and what else the framework offers
- [AudioToolbox encode](/quest/m2/audio-encode-audiotoolbox.md) - macOS and iOS encode AAC-LC
- [mp4-atom dOps mapping](/quest/m2/mp4-atom-dops-mapping.md) - a released mp4-atom reads and writes any `dOps` channel mapping family and table
- [CMAF surround Opus](/quest/m2/cmaf-opus-surround.md) - fMP4 import and export carry an Opus channel mapping table
- [GPU CI](/quest/m2/gpu-ci.md) - NVIDIA tests run nightly on real hardware, and `just rs nvidia` runs them locally instead of skipping
- [Simulcast rung disable](/quest/m2/simulcast-rung-disable.md) - JS, Rust/FFI, and OBS publishers stop encoding the top renditions their grant cannot fund, advertise `enabled: false`, and re-enable with hysteresis
Expand Down
10 changes: 3 additions & 7 deletions quest/m2/cmaf-opus-surround.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ exports to a `dOps` that keeps the table. Today both directions refuse it.
## Plan

Build the head from the `dOps` family and table with `opus::Mapping` on import,
and write the table from the parsed head on export in place of the
`UnsupportedMappingFamily` refusal in `synthesize_audio_trak`. Keep refusing
families the head cannot describe.
and write the table from the parsed head on export, in place of the
`UnsupportedMappingFamily` refusals in the fMP4 importer and
`synthesize_audio_trak`. Keep refusing families the head cannot describe.

Regression: a family 1 5.1 `dOps` round-trips through import and export with
its table intact.

## Required

- [mp4-atom dOps mapping](/quest/m2/mp4-atom-dops-mapping.md) - `Dops` carries the mapping family and table
15 changes: 0 additions & 15 deletions quest/m2/mp4-atom-dops-mapping.md

This file was deleted.

7 changes: 5 additions & 2 deletions rs/moq-mux/src/container/fmp4/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,12 @@ impl<E: crate::catalog::hang::CatalogExt> Import<E> {
}
mp4_atom::Codec::Opus(opus) => {
// dOps carries the OpusHead fields in ISOBMFF byte order; republish them as the
// OpusHead description so decoders apply its pre-skip and gain. mp4-atom already
// refuses a nonzero channel mapping family, so the table is never dropped here.
// OpusHead description so decoders apply its pre-skip and gain. A mapping table
// is refused rather than dropped, since the head built here is family 0.
let dops = &opus.dops;
if let Some(mapping) = &dops.channel_mapping {
return Err(crate::codec::opus::Error::UnsupportedMappingFamily(mapping.family).into());
}
let mut head =
crate::codec::opus::Config::new(dops.input_sample_rate, dops.output_channel_count as u32)
.with_pre_skip(dops.pre_skip);
Expand Down
42 changes: 31 additions & 11 deletions rs/moq-mux/src/container/fmp4/import_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,19 +688,23 @@ fn opus_init(entry_rate: u16) -> (mp4_atom::Dops, Vec<u8>) {
pre_skip: 312,
input_sample_rate: 44_100,
output_gain: -1536,
channel_mapping: None,
};
(dops.clone(), opus_init_with(entry_rate, dops))
}

fn opus_init_with(entry_rate: u16, dops: mp4_atom::Dops) -> Vec<u8> {
let opus = mp4_atom::Opus {
audio: mp4_atom::Audio {
data_reference_index: 1,
channel_count: 2,
channel_count: dops.output_channel_count as u16,
sample_size: 16,
sample_rate: mp4_atom::FixedPoint::from(entry_rate),
},
dops: dops.clone(),
dops,
btrt: None,
};
let data = audio_init(super::build_audio_trak(1, 48_000, mp4_atom::Codec::from(opus)));
(dops, data)
audio_init(super::build_audio_trak(1, 48_000, mp4_atom::Codec::from(opus)))
}

/// dOps becomes the OpusHead description, and a track re-exported from that description
Expand Down Expand Up @@ -743,17 +747,33 @@ fn opus_catalog_uses_the_decode_rate() {
/// A dOps with a channel mapping table is refused rather than imported without it.
#[test]
fn opus_dops_mapping_family_is_refused() {
let (_, mut data) = opus_init(48_000);

// The mapping family byte follows version, channels, pre-skip, rate, and gain.
let at = data.windows(4).position(|w| w == b"dOps").unwrap() + 4 + 10;
assert_eq!(data[at], 0);
data[at] = 1;
let data = opus_init_with(
48_000,
mp4_atom::Dops {
output_channel_count: 2,
pre_skip: 312,
input_sample_rate: 48_000,
output_gain: 0,
channel_mapping: Some(mp4_atom::OpusChannelMapping {
family: 1,
stream_count: 1,
coupled_count: 1,
channel_mapping: vec![0, 1],
}),
},
);

let mut broadcast = moq_net::broadcast::Info::new().produce();
let catalog = crate::catalog::Producer::new(&mut broadcast, crate::catalog::Config::default()).unwrap();
let mut fmp4 = crate::container::fmp4::Import::new(broadcast, catalog.reserve());
assert!(fmp4.decode(&bytes::BytesMut::from(data.as_slice())).is_err());
let err = fmp4.decode(&bytes::BytesMut::from(data.as_slice())).unwrap_err();
assert!(
matches!(
err,
crate::Error::Opus(crate::codec::opus::Error::UnsupportedMappingFamily(1))
),
"{err:?}"
);
assert!(catalog.snapshot().audio.renditions.is_empty());
}

Expand Down
1 change: 1 addition & 0 deletions rs/moq-mux/src/container/fmp4/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,7 @@ pub(crate) fn synthesize_audio_trak(track_id: u32, timescale: u64, config: &Audi
pre_skip: head.pre_skip,
input_sample_rate: head.sample_rate,
output_gain: head.output_gain,
channel_mapping: None,
},
btrt: None,
})
Expand Down
Loading