Fix read-fault misclassification, DTS AMODE channel table, and untestable guards

- resolve_fmts_key_map: distinguish a genuinely-not-FMTS disc from a
  transient live-drive read fault. read_filesystem now returns the new
  Error::UdfNotFilesystem for a deterministic tag/format mismatch (no AVDP,
  no partition descriptor, no FSD); resolve maps only UdfNotFilesystem (fs)
  and UdfNotFound (.tbl absent) to Ok(None), and PROPAGATES DiscRead / other
  I/O faults so a marginal AACS 2.1 disc fails loud instead of silently
  dropping forensic content under a base-Unit-Key-only map.

- DTS_AMODE_CH (mp4/audio.rs): extend 10→16 entries
  {1,2,2,2,2,3,3,4,4,5,6,6,6,7,8,8} (ff_dca_channels / ETSI TS 102 114) so
  the spec-legal high AMODEs that now pass the decodability gate declare
  their true channelcount (AMODE 13→7, 14/15→8) instead of a truncated 6.

- session.rs resolve_keys "called before scan" guard is now testable:
  from_parts_for_test takes Option<Disc>; added a test that a disc-less
  session returns a clean DeviceNotReady Err rather than panicking.

- mp4/read.rs: a track with samples but a missing/malformed stts (mandatory
  per ISO/IEC 14496-12) is dropped rather than emitting all-zero timestamps,
  matching the existing stco/stsc guards; all-tracks-dropped → Mp4Invalid.

- Remove the inert MuxInput::Iso.key_map field (the Iso path re-derives its
  map inside build_iso_pipeline); the live path keeps Live.key_map.

All four fixes are mutation-verified.
This commit is contained in:
Matthew Jackson
2026-07-24 09:59:33 -07:00
parent 7ba43d9c02
commit eb0aa3556e
7 changed files with 248 additions and 32 deletions
+2 -8
View File
@@ -111,10 +111,6 @@ pub enum MuxInput<'a> {
format: crate::disc::ContentFormat,
/// Decryption keys for the title (`DecryptKeys::None` for raw/clear).
keys: DecryptKeys,
/// Optional pre-resolved AACS key map. Carried for forward-compat and
/// the live path; the file highway re-derives its own map from
/// `keys`/`key_fetch` inside [`build_iso_pipeline`].
key_map: Option<Arc<AacsKeyMap>>,
/// Optional read-time key fetch closure (banked by `resolve_keys`).
key_fetch: Option<KeyFetch>,
},
@@ -280,7 +276,6 @@ pub fn mux_stream(
title,
format,
keys,
key_map: _,
key_fetch,
} => {
let reader = FileSectorSource::open(path)?;
@@ -1307,7 +1302,6 @@ mod tests {
title,
format: crate::disc::ContentFormat::BdTs,
keys: DecryptKeys::None,
key_map: None,
key_fetch: None,
},
"null://",
@@ -1620,7 +1614,7 @@ mod tests {
let disc = aacs_session_disc(title, unit_key);
// No caller key_fetch: a single-CPS disc resolves its base map with the
// banked unit key alone (the FMTS/multi-CPS fetch path is not exercised).
let mut session = DiscSession::from_parts_for_test(disc, Some(reader), None);
let mut session = DiscSession::from_parts_for_test(Some(disc), Some(reader), None);
let opts = MuxOptions {
skip_errors: false, // a DecryptFailed must PROPAGATE, not zero-fill
@@ -1670,7 +1664,7 @@ mod tests {
}];
let disc = aacs_session_disc(title, unit_key);
// reader: None — never staged.
let mut session = DiscSession::from_parts_for_test(disc, None, None);
let mut session = DiscSession::from_parts_for_test(Some(disc), None, None);
let opts = MuxOptions {
skip_errors: false,