Support gapless MP3 playback
The MP3 format has an inherent delay due to the MDCT + polyphase filterbank, and encoders may add their own delay.
While determining the encoder delay isn't possible for every MP3 file, LAME includes an extension to the Xing info that explicitly lists the encoder delay.
I have a (work-in-progress) branch that parses this delay field and offsets the timestamp. However, Mediabunny really doesn't seem to like negative timestamps; despite the documentation explicitly saying that timestamps may be negative, there are a ton of code paths that assert that they aren't. This would also require API consumers to explicitly notice and trim the delay themselves based on the timestamp.
An alternative approach would be to automatically trim the leading and trailing samples in the decoding step. This has the downside that we'd have to do it for each combination of codec and container, but would avoid pesky negative samples. It would also better handle trimming of trailing samples in general; I'm not sure what actually happens if the advertised duration of an audio packet is shorter than its actual sample count.
Source: Vanilagy/mediabunny