diff mbox series

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

Message ID 20210106031234.13435-1-guangxin.xu@intel.com
State New
Headers show
Series [FFmpeg-devel] avcodec/qsv_enc: do not reuse enc_ctrl from previous frames
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Xu Guangxin Jan. 6, 2021, 3:12 a.m. UTC
fixes #8857

If we do not clear the enc_ctrl, we will reuse previous frames' data like FrameType.
---
 libavcodec/qsvenc.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Xiang, Haihao Jan. 6, 2021, 6:53 a.m. UTC | #1
On Wed, 2021-01-06 at 11:12 +0800, Xu Guangxin wrote:
> fixes #8857
> 
> If we do not clear the enc_ctrl, we will reuse previous frames' data like
> FrameType.
> ---
>  libavcodec/qsvenc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 2bd2a56227..94473c4eab 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -1249,6 +1249,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);
>              }

LGTM

Thanks
Haihao
diff mbox series

Patch

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 2bd2a56227..94473c4eab 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1249,6 +1249,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);
             }