forge
Explore
Log in

Don't you dare go Hollow

S1: MP3 tail frame takes its sample count from the parsed header (576 for MPEG-2/2.5 LSF, was 1152; toward ffmpeg)

Browse files at this commit

59ba65080761d759928dbc2e241bd5bc47bcefc1Ahmet Kaan GümüşParent: 0e5f24c
crates/ec-probe/src/raw.rsmodified+6 -4
@@ -204,10 +204,12 @@ impl<R: Read + Seek> RawDemuxer<R> {
204204 Ok(f) => return Ok(f),
205205 Err(e) if e.is_need_more() && tail => {
206206 // The tail of a file: whatever is left is the last frame.
207- return Ok(Framing {
208- bytes: left,
209- samples: self.frame_samples(),
210- });
207+ let samples = match kind {
208+ Kind::Mp3 => ec_mp3::FrameHeader::parse(self.window())
209+ .map_or(self.frame_samples(), |h| h.samples_per_frame() as u64),
210+ _ => self.frame_samples(),
211+ };
212+ return Ok(Framing { bytes: left, samples });
211213 }
212214 Err(_) if skipped < (1 << 20) => {
213215 self.head += 1;