[FFmpeg-devel] [PATCH] lavfi/qsvvpp: Copy frame props before modify it

Wang, Fei W fei.w.wang at intel.com
Mon Nov 25 05:16:17 EET 2024


On Mon, 2024-11-25 at 02:31 +0000, Xiang, Haihao wrote:
> On Vr, 2024-11-22 at 13:18 +0800,
> fei.w.wang-at-intel.com at ffmpeg.org wrote:
> > From: Fei Wang <fei.w.wang at intel.com>
> > 
> > The changes to output frame props in query_frame overlapped since
> > b14ed6ea58. Move the copy frame props before the changes.
> 
> I can't find commit b14ed6ea58, could you double check the bad commit
> ?

Fixed in V2. Thanks.

> 
> Thanks
> Haihao
> 
> > 
> > Signed-off-by: Fei Wang <fei.w.wang at intel.com>
> > ---
> >  libavfilter/qsvvpp.c | 23 ++++++++++++-----------
> >  1 file changed, 12 insertions(+), 11 deletions(-)
> > 
> > diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
> > index 0818ada117..67ae23b165 100644
> > --- a/libavfilter/qsvvpp.c
> > +++ b/libavfilter/qsvvpp.c
> > @@ -471,7 +471,8 @@ static QSVFrame *submit_frame(QSVVPPContext *s,
> > AVFilterLink *inlink, AVFrame *p
> >  }
> >  
> >  /* get the output surface */
> > -static QSVFrame *query_frame(QSVVPPContext *s, AVFilterLink
> > *outlink, const
> > AVFrame *in)
> > +static QSVFrame *query_frame(QSVVPPContext *s, AVFilterLink
> > *outlink, const
> > AVFrame *in,
> > +                             const AVFrame *propref)
> >  {
> >      FilterLink *l = ff_filter_link(outlink);
> >      AVFilterContext *ctx = outlink->src;
> > @@ -513,6 +514,15 @@ static QSVFrame *query_frame(QSVVPPContext *s,
> > AVFilterLink *outlink, const AVFr
> >              return NULL;
> >      }
> >  
> > +    if (propref) {
> > +        ret = av_frame_copy_props(out_frame->frame, propref);
> > +        if (ret < 0) {
> > +            av_frame_free(&out_frame->frame);
> > +            av_log(ctx, AV_LOG_ERROR, "Failed to copy metadata
> > fields from
> > src to dst.\n");
> > +            return NULL;
> > +        }
> > +    }
> > +
> >      if (l->frame_rate.num && l->frame_rate.den)
> >          out_frame->frame->duration = av_rescale_q(1, av_inv_q(l-
> > >frame_rate),
> > outlink->time_base);
> >      else
> > @@ -985,7 +995,7 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s,
> > AVFilterLink
> > *inlink, AVFrame *picr
> >      }
> >  
> >      do {
> > -        out_frame = query_frame(s, outlink, in_frame->frame);
> > +        out_frame = query_frame(s, outlink, in_frame->frame,
> > propref);
> >          if (!out_frame) {
> >              av_log(ctx, AV_LOG_ERROR, "Failed to query an output
> > frame.\n");
> >              return AVERROR(ENOMEM);
> > @@ -1009,15 +1019,6 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s,
> > AVFilterLink *inlink, AVFrame *picr
> >              break;
> >          }
> >  
> > -        if (propref) {
> > -            ret1 = av_frame_copy_props(out_frame->frame, propref);
> > -            if (ret1 < 0) {
> > -                av_frame_free(&out_frame->frame);
> > -                av_log(ctx, AV_LOG_ERROR, "Failed to copy metadata
> > fields
> > from src to dst.\n");
> > -                return ret1;
> > -            }
> > -        }
> > -
> >          out_frame->frame->pts = av_rescale_q(out_frame-
> > > surface.Data.TimeStamp,
> >                                               default_tb, outlink-
> > >time_base);
> >  
> 



More information about the ffmpeg-devel mailing list