mpegaudio: handle VBRI tag in packetiser as well
authorKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 23 Nov 2021 10:26:10 +0000 (11:26 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 23 Nov 2021 10:26:10 +0000 (11:26 +0100)
nihav-mpeg/src/codecs/mpegaudio/mod.rs

index 187a695938de6f62d01485c446f1496820ca96d7..0f44e89aea39304f19e0844a14c4c5921aa7d98d 100644 (file)
@@ -376,6 +376,8 @@ impl NAPacketiser for MPAPacketiser {
                 if (flags & 1) != 0 {
                     duration = u64::from(read_u32be(&self.buf[offset + 8..]).unwrap_or(0));
                 }
+            } else if self.buf.len() >= offset + 18 && &self.buf[offset..][..6] == b"VBRI\x00\x01" {
+                duration = u64::from(read_u32be(&self.buf[offset + 14..]).unwrap_or(0));
             }
         }
         let ainfo = NAAudioInfo::new(hdr.srate, hdr.channels, SND_F32P_FORMAT, hdr.nsamples);