[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


According to the documentation of av_parser_parse2:

"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:

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


More information about the ffmpeg-devel mailing list