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 commit59ba65080761d759928dbc2e241bd5bc47bcefc1Parent: 0e5f24c1 changed file +6 -4
crates/ec-probe/src/raw.rsmodified+6 -4
| @@ -204,10 +204,12 @@ impl<R: Read + Seek> RawDemuxer<R> { | ||
| 204 | 204 | Ok(f) => return Ok(f), |
| 205 | 205 | Err(e) if e.is_need_more() && tail => { |
| 206 | 206 | // 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 }); | |
| 211 | 213 | } |
| 212 | 214 | Err(_) if skipped < (1 << 20) => { |
| 213 | 215 | self.head += 1; |