[FFmpeg-devel] [PATCH] Ac3/AAC parser: remove incomplete first frames

Baptiste Coudurier baptiste.coudurier
Sun Jan 24 23:25:21 CET 2010

On 1/24/10 1:53 PM, Reimar D?ffinger wrote:
> On Sun, Jan 24, 2010 at 04:43:51PM -0500, Justin Ruggles wrote:
>> Reimar D?ffinger wrote:
>>> this is what causes decode errors and annoying sounds after seeking.
>>> The following patch has one annoyance: if there is a frame starting
>>> right at position 0 it will still return a 0-sized frame initially
>>> (and claim to have consumed 0 bytes).
>>> But now that I can say for sure that the problem is there maybe
>>> someone will fix it properly (or I'll threaten to apply this).
>> I thought that parsers are not supposed to discard anything.  The AC-3
>> parser used to discard partial frames, but it was changed to send them
>> to the decoder.
> I think it should discard as much as necessary so that a arbitrarily
> cut valid file will not cause errors. But I am biased.

I agree with this as well, and it's also necessary when stream copying. 
You don't want partial frames in the output. That is I'm biased as well.

I believe a PARSER_FLAG_OUTPUT_PARTIAL_FRAMES can be introduced and set 
by the user application if partial frames are not wanted, this applies 
to all parsers (mp3, mpeg1/2, h264).
Then user application should set AVFMT_FLAG_OUTPUT_PARTIAL_FRAMES in 
AVFormatContext->flags which will set PARSER_FLAG_OUTPUT_PARTIAL_FRAMES 
in return.

Comments and flags name suggestions very welcome.


Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org

More information about the ffmpeg-devel mailing list