[FFmpeg-devel] [PATCH] decode.c: Handle 0-size packets in compat_decode

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Jul 4 21:20:38 EEST 2017

On 04.07.2017, at 10:42, wm4 <nfxjfg at googlemail.com> wrote:
> Not really comfortable with the current patch. Why does it even touch
> the compat_decode_partial_size handling path?

Because that is the code that gets utterly confused by 0-size packets and breaks everything.
For ac3 what happens is that after the first 0-sized packets all following packets fail to decode.
Probably that means the whole partial_size thing is broken and not robust, but I haven't been able to really understand it.

> If you really want this, then I think you should go all the way and
> implement the implicit drain-and-flush behavior that the old API
> exposed with most decoders. (Meaning you can drain the decoder, and
> then it's implicitly flushed, so that sending new packets will restart
> decoding.)

Yeah, I just don't feel particularly confident implementing that, since this compat wrapper has all kinds of weird code and no comments...

> Either that, or skip empty packets on the API user side. If a
> libavformat demuxer or libavcodec parser is producing empty packets,
> these should probably be fixed.

Skipping it on user side is of course what I did, but it doesn't provide compatibility.
Any distribution e.g. updating FFmpeg more often than MPlayer will break.

More information about the ffmpeg-devel mailing list