[FFmpeg-devel] [PATCH v3 3/3] aadec: fix seeking in mp3 content

Karsten Otto ottoka at posteo.de
Mon Jul 2 20:21:43 EEST 2018


> Am 02.07.2018 um 10:59 schrieb Michael Niedermayer <michael at niedermayer.cc>:
> 
> Signierter PGP-Teil
> On Thu, Jun 21, 2018 at 06:58:26PM +0200, Karsten Otto wrote:
>> MP3 frames may not be aligned to aa chunk boundaries. After seeking,
>> scan for the next valid frame header. Then truncate the packet, and
>> also adjust timestamp information accordingly.
>> ---
>> libavformat/aadec.c | 33 ++++++++++++++++++++++++++++-----
>> 1 file changed, 28 insertions(+), 5 deletions(-)
> 
> Please see AVSTREAM_PARSE_TIMESTAMPS
> 
> This codec specific code in demuxers should not be needed
> 
I tried that before, and you are right that it takes care of timestamp adjustments.

However, after a seek the parsed packet still contains a partial frame before the
next full one. I had expected libavformat/mpegaudio_parser.c to detect this
situation and discard the fragment, but unfortunately it does not. Instead it passes
it unchanged to the codec, which plays it as a pop or even a very ugly BLEEEP -
painful while wearing headphones!

I assume this situation never arose with other (more sane) format demuxers…
So, should I rather try to patch mpegaudio_parser? Seems risky?

> [...]
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> I have never wished to cater to the crowd; for what I know they do not
> approve, and what they approve I do not know. -- Epicurus
> 
> 



More information about the ffmpeg-devel mailing list