address review: run MP4 table guard only for MP4 or unknown containers

This commit is contained in:
Dylan M. Taylor
2026-11-03 19:44:37 +00:00
parent 006d27fd1c
commit 1138860d5d
+2 -1
View File
@@ -71,7 +71,8 @@ pub fn probe_headers(bytes: &Bytes) -> Result<MediaInfo> {
};
if info.audio.is_none() && info.video.is_none() || info.audio.as_ref().is_some_and(|a| a.sample_rate == 0) {
// Plain audio files (and anything our demuxers didn't describe): symphonia's probe.
if !crate::mp4guard::probe_fits(bytes) {
// Known non-MP4 containers (a WAV's audio bytes can spell an `ftyp`) skip the MP4 table check.
if matches!(c, Container::Mp4 | Container::Unknown) && !crate::mp4guard::probe_fits(bytes) {
return Err(MediaError::Corrupt("the MP4's sample tables do not fit the file".into()));
}
let (codec, rate, channels, frames) = std::panic::catch_unwind(|| crate::audio::probe_symphonia(bytes, c.name()))