1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-08 13:22:53 +02:00

lavfi/qsvvpp: Copy frame props before modify it

The changes to output frame props in query_frame overlapped since
578ac59887. Move the copy frame props before the changes.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
This commit is contained in:
Fei Wang 2024-11-25 11:18:00 +08:00 committed by Haihao Xiang
parent 351fd8460a
commit bc991ca048

View File

@ -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);