[FFmpeg-devel] [mpegaudio_parser] Skip trailing junk data when flushing parser.

Michael Niedermayer michael at niedermayer.cc
Sat Feb 24 05:01:06 EET 2018


On Fri, Feb 23, 2018 at 11:15:09AM -0800, Dale Curtis wrote:
> Whoops, that version spams on every flush; changed to only print when
> buf_size > 0.
> 
> - dale
> 
> On Fri, Feb 23, 2018 at 10:37 AM, Dale Curtis <dalecurtis at chromium.org>
> wrote:
> 
> > After some deeper testing it looks like this mechanism can actually fully
> > replace the existing ID3 and APE tag skips; so I've simplified the patch to
> > do so.
> >
> > - dale
> >
> >
> > On Thu, Feb 22, 2018 at 4:46 PM, Dale Curtis <dalecurtis at chromium.org>
> > wrote:
> >
> >> The parser should only return valid mpeg audio packets; it generally
> >> does so, but in the case of flush, it returns whatever happens to
> >> be in the buffer instead of ensuring its first a valid mpeg packet.
> >>
> >> The fix is to check whether a valid frame size has been parsed and
> >> if not discard the packet when flushing.
> >>
> >> This should fix all sorts of mp3 files with trailing garbage.
> >>
> >> Signed-off-by: Dale Curtis <dalecurtis at chromium.org>
> >>
> >>
> >

>  mpegaudio_parser.c |   11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 91db6134e5c81519dd88289c8956851015183515  fix_trailing_garbage_mp3_v3.patch
> From b81ec4a9a3907e21cc4c4abcf5502778be94076a Mon Sep 17 00:00:00 2001
> From: Dale Curtis <dalecurtis at chromium.org>
> Date: Thu, 22 Feb 2018 16:43:37 -0800
> Subject: [PATCH] [mpegaudio_parser] Skip trailing junk data when flushing
>  parser.
> 
> The parser should only return valid mpeg audio packets; it generally
> does so, but in the case of flush, it returns whatever happens to
> be in the buffer instead of ensuring its first a valid mpeg packet.

this goes the wrong direction.
Parsers should not discard data by default. The code we have for tags is a hack.
There are many better ways to handle this.
Something similar to a AV_PKT_FLAG_CORRUPT set be the parser would be an
example. This could then optionally be discarded


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180224/70879624/attachment.sig>


More information about the ffmpeg-devel mailing list