[FFmpeg-devel] [PATCH] avcodec/qsv_enc: do not reuse enc_ctrl from previous frames
Xiang, Haihao
haihao.xiang at intel.com
Fri Sep 10 04:11:25 EEST 2021
On Thu, 2021-09-09 at 12:54 -0300, James Almer wrote:
> On 9/9/2021 12:41 PM, Xiang, Haihao wrote:
> > On Thu, 2021-09-09 at 12:32 -0300, James Almer wrote:
> > > On 1/6/2021 12:12 AM, 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));
> > >
> > > I assume cur->enc_ctrl.ExtParam is not set, right? Otherwise this memset
> > > could lead to leaks.
> >
> > Right, it is not set.
>
> Applied then.
Thanks James
More information about the ffmpeg-devel
mailing list