[FFmpeg-devel] Invalid behaviour of av_parser_parse2 with some content

Jean-Yves Avenard jyavenard at gmail.com
Wed Oct 25 19:37:59 EEST 2017


Hi.

According to the documentation of av_parser_parse2:
https://www.ffmpeg.org/doxygen/trunk/group__lavc__parsing.html#ga691ca0258e91f99297e7726f56d8c247


"poutbuf_size  set to size of parsed buffer or zero if not yet finished. "

So we can expect that both poutbuf_size and poutbuf will be set upon
av_parser_parse2 returning.

However, looking at the code of some parser, such as the vp8 decoder:
http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/vp8_parser.c;h=609f5077d1a1b2add1dd3e13f0508615428dafa0;hb=HEAD#l30

we can see that the vp8 parser will do return buf_size immediately
under some circumstances (such as the size being to small, the sync
code being invalid and so forth... but when doing so doesn't set the
two out parameters.

I believe this is a bug....

Either the documentation needs fixing, or the two out parameters needs
to be set to poutbuf and poutbuf_size respectively as all data is to
be consumed.

An alternative would be to set them both to 0 if content is invalid
(or too small) and as such we don't want the parser to output
anything.

Thanks
JY


More information about the ffmpeg-devel mailing list