[FFmpeg-cvslog] avcodec/qsv_enc: do not reuse enc_ctrl from previous frames

Xu Guangxin git at videolan.org
Thu Sep 9 18:53:47 EEST 2021


ffmpeg | branch: master | Xu Guangxin <guangxin.xu at intel.com> | Wed Jan  6 11:12:34 2021 +0800| [3bbe0c210b05fc6fbd7b1d4bbd8479db7f2cf957] | committer: James Almer

avcodec/qsv_enc: do not reuse enc_ctrl from previous frames

fixes #8857

If we do not clear the enc_ctrl, we will reuse previous frames' data like FrameType.

Reviewed-by: Xiang, Haihao <haihao.xiang at intel.com>
Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3bbe0c210b05fc6fbd7b1d4bbd8479db7f2cf957
---

 libavcodec/qsvenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 50ec7065ca..090fdbe75e 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1271,6 +1271,8 @@ static void clear_unused_frames(QSVEncContext *q)
     while (cur) {
         if (cur->used && !cur->surface.Data.Locked) {
             free_encoder_ctrl_payloads(&cur->enc_ctrl);
+            //do not reuse enc_ctrl from previous frame
+            memset(&cur->enc_ctrl, 0, sizeof(cur->enc_ctrl));
             if (cur->frame->format == AV_PIX_FMT_QSV) {
                 av_frame_unref(cur->frame);
             }



More information about the ffmpeg-cvslog mailing list