From 59ba65080761d759928dbc2e241bd5bc47bcefc1 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 15:13:04 +0300 Subject: [PATCH] S1: MP3 tail frame takes its sample count from the parsed header (576 for MPEG-2/2.5 LSF, was 1152; toward ffmpeg) --- crates/ec-probe/src/raw.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/ec-probe/src/raw.rs b/crates/ec-probe/src/raw.rs index 9101904c..bddfc266 100644 --- a/crates/ec-probe/src/raw.rs +++ b/crates/ec-probe/src/raw.rs @@ -204,10 +204,12 @@ impl RawDemuxer { Ok(f) => return Ok(f), Err(e) if e.is_need_more() && tail => { // The tail of a file: whatever is left is the last frame. - return Ok(Framing { - bytes: left, - samples: self.frame_samples(), - }); + let samples = match kind { + Kind::Mp3 => ec_mp3::FrameHeader::parse(self.window()) + .map_or(self.frame_samples(), |h| h.samples_per_frame() as u64), + _ => self.frame_samples(), + }; + return Ok(Framing { bytes: left, samples }); } Err(_) if skipped < (1 << 20) => { self.head += 1;