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> {
204 Ok(f) => return Ok(f),204 Ok(f) => return Ok(f),
205 Err(e) if e.is_need_more() && tail => {205 Err(e) if e.is_need_more() && tail => {
206 // The tail of a file: whatever is left is the last frame.206 // The tail of a file: whatever is left is the last frame.
207- return Ok(Framing {207+ let samples = match kind {
208- bytes: left,208+ Kind::Mp3 => ec_mp3::FrameHeader::parse(self.window())
209- samples: self.frame_samples(),209+ .map_or(self.frame_samples(), |h| h.samples_per_frame() as u64),
210- });210+ _ => self.frame_samples(),
211+ };
212+ return Ok(Framing { bytes: left, samples });
211 }213 }
212 Err(_) if skipped < (1 << 20) => {214 Err(_) if skipped < (1 << 20) => {
213 self.head += 1;215 self.head += 1;