lavc/encode: fix frame_number double-counted
authorZhong Li <zhong.li@intel.com>
Thu, 28 Jun 2018 09:01:46 +0000 (17:01 +0800)
committerZhong Li <zhong.li@intel.com>
Mon, 27 Aug 2018 08:54:40 +0000 (16:54 +0800)
commitd91370e0f12a3fedd477616011566d9f2fb5e3e5
treee8d0090cc930ebe650437b882f22216e8c976b2d
parent3aacb0d196d1c89c386fe26a5df8d994a3eef619
lavc/encode: fix frame_number double-counted

Encoder frame_number may be double-counted if some frames are cached and then flushed.
Take qsv encoder (some frames are cached firsty for asynchronism) as example,
./ffmpeg -loglevel verbose -hwaccel qsv -c:v h264_qsv -i in.mp4 -vframes 100 -c:v h264_qsv out.mp4
frame_number passed to encoder is double-counted and larger than the accurate value.
Libx264 encoding with B frames can also reproduce it.

Signed-off-by: Zhong Li <zhong.li@intel.com>
libavcodec/encode.c