[FFmpeg-devel] [PATCH] 04: dtsdec: fix attempts to decode incomplete frames

Benjamin Larsson banan
Thu May 17 15:49:17 CEST 2007

Michael Niedermayer wrote:
> Hi
> On Thu, May 17, 2007 at 02:01:22PM +0400, Pavlov Konstantin wrote:
>> Hello.
>> When (!len) is checked in the buffer fill loop in dts_decode_frame(),
>> the buffer does not contain a complete frame, therefore executing
>> "break" when there is no more input data is not correct (subsequent
>> code will try to decode the buffer, which then will lead to garbage
>> output and sync loss).  The proper action is to return the number of
>> consumed bytes and wait for more data.
>> The problematic case can be triggered by mplayer - apparently it
>> passes the stream to decoder without caring about frame boundaries,
>> and sometimes the data block happens to contain just the frame header;
>> in this case the first pass through the loop will consume HEADER_SIZE
>> bytes from the input data, and the second pass would trigger the bug.
> libavcodec decoders must always be feeded with complete frames
> patch rejected
> an exception to this is possible _only_ if CODEC_FLAG_TRUNCATED AND
> CODEC_CAP_TRUNCATED is set AND the decoder needs 1 pass less over the
> data than parser+decoder (=its faster to not split the stream into frames)
> [...]

How about we just svn remove the file instead.

Benjamin Larsson

More information about the ffmpeg-devel mailing list