From 65a1e04243907e37732c81c6d4083ca469e5bd58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 2 Dec 2026 07:42:54 +0300 Subject: [PATCH] ec-ac3 real_library: allow ffmpeg's trailing truncated frame in sample count monsters_inc_5.1_448_small.ac3 is 100000 bytes: 55 whole 1792-byte frames plus a 1440-byte stub. ffmpeg 9.0.2 reports 'incomplete frame' and still emits 1536 samples/ch for it (516096 f32 total = 86016/ch, 56 frames); the decoder correctly stops at 55 (506880 total). Truncating the first 55 frames gives ffmpeg 506880 exactly. Test now allows at most one extra frame of ffmpeg output, then compares the common prefix. --- crates/ec-ac3/tests/it/real_library.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/ec-ac3/tests/it/real_library.rs b/crates/ec-ac3/tests/it/real_library.rs index ebdae6bf..8bd97ced 100644 --- a/crates/ec-ac3/tests/it/real_library.rs +++ b/crates/ec-ac3/tests/it/real_library.rs @@ -98,7 +98,13 @@ fn fate_ac3_and_eac3_match_ffmpeg() { for path in files { let name = path.file_name().unwrap().to_string_lossy().into_owned(); let (ours, decoded_channels) = decode(&path); - let theirs = reference(&path); + let mut theirs = reference(&path); + let extra = theirs.len().saturating_sub(ours.len()); + assert!( + extra <= 1536 * decoded_channels, + "{name}: ffmpeg has {extra} extra samples, more than one truncated frame" + ); + theirs.truncate(ours.len()); assert_eq!(ours.len(), theirs.len(), "{name}: sample count vs ffmpeg"); assert!(!ours.is_empty(), "{name}: nothing decoded");