[FFmpeg-devel] [PATCH] flac_parser.c: fix case when final frame is a false positive

Michael Chinen mchinen at gmail.com
Fri Jun 28 23:54:16 CEST 2013


On Fri, Jun 28, 2013 at 8:31 PM, Paul B Mahol <onemda at gmail.com> wrote:
> On 6/28/13, Michael Chinen <mchinen at gmail.com> wrote:
>> Should fix https://ffmpeg.org/trac/ffmpeg/ticket/2552
>> Only did minimal testing on a few files and fate.
>>
>
>
>> From e2ba4117fa728c7d86a60c5032339795bf24c170 Mon Sep 17 00:00:00 2001
>> From: Michael Chinen <m at roughsoft.com>
>> Date: Thu, 27 Jun 2013 18:49:11 -1000
>> Subject: [PATCH] flac_parser.c: fix case when final frame is a false positive
>
> Could you explain what is fixed and why?

The parser scores headers based on subsequent changes to header info.
However, it only looks into the future headers, and doesn't care about
the past.  Once a frame is output and leaves the parser, it does not
keep any info about it, and scores are recalculated to reflect what is
in the buffer.  This usually works because bad headers get penalized
for the changes with the next valid header sequence, but when it is
the last one, it doesn't get penalized at all and is falsely output as
a good frame.

The fix just keeps track of the last output header and uses that as a
base score.  It also now requires a positive score (this may need
tweaking to make it more strict since the default base score and
penalties per property change are arbitrary).

>
> I found it "odd" that this bug appeared once some internal changes to
> lavf was done.

Presumably this bug is more rare since it requires a valid crc but
false postive header after the last valid header.  Ideally this would
be tested on flacs with some false positives in the middle, but I
don't have any now.

Michael


More information about the ffmpeg-devel mailing list