Gapless MP3s and mpegaudioparse

dv dv at pseudoterminal.org
Thu Jul 26 11:20:04 PDT 2012


Hello,

I have been developing a plugin for an mp3 decoder, and noticed that 
LAME tags are not processed properly by mpegaudioparse. The 
gst_mpeg_audio_parse_handle_first_frame() call in gstmpegaudioparse.c 
parses the tag, assigns the read padding and latency values to variables 
in the mp3parse struct, but doesn't actually do anything with them.

Fortunately, the decode is capable of detecting the LAME tag, and omits 
the padding accordingly. If I play with the alsasink for output, and set 
its sync property to FALSE (= let it ignore timestamps), the sound is 
fine. But with sync set to TRUE, I still hear gaps.

That makes me thing that the timestamps are wrong, and need readjustment 
(that is, the padding needs to be subtracted from them). Apparently, the 
GstAudioDecoder base class (which I use) calculates timestamp and 
duration of buffers based on upstream information, which in this case, 
needs to be adjusted. What is the best approach to do so? I could deduce 
the proper buffer duration from the number of decoded bytes (since as 
said, the decoder omits the padding indicated by the LAME tag), but what 
then? Should I adjust timestamps in a custom pre_push function?

- Carlos


More information about the gstreamer-devel mailing list