lavfi/qsvvpp: do not mix up FFmpeg and SDK error code

The function ff_qsvvpp_filter_frame should return a FFmpeg error code if
there is an error. However it might return a SDK error code without this
patch.

Reviewed-by: Soft Works <softworkz@hotmail.com>
This commit is contained in:
Haihao Xiang 2021-07-30 10:39:24 +08:00 committed by James Almer
parent 3f92496d9e
commit 43aeeab764
1 changed files with 9 additions and 6 deletions

View File

@ -807,8 +807,7 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picr
filter_ret = s->filter_frame(outlink, tmp->frame); filter_ret = s->filter_frame(outlink, tmp->frame);
if (filter_ret < 0) { if (filter_ret < 0) {
av_frame_free(&tmp->frame); av_frame_free(&tmp->frame);
ret = filter_ret; return filter_ret;
break;
} }
tmp->queued--; tmp->queued--;
s->got_frame = 1; s->got_frame = 1;
@ -842,7 +841,7 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picr
if (ret < 0 && ret != MFX_ERR_MORE_SURFACE) { if (ret < 0 && ret != MFX_ERR_MORE_SURFACE) {
/* Ignore more_data error */ /* Ignore more_data error */
if (ret == MFX_ERR_MORE_DATA) if (ret == MFX_ERR_MORE_DATA)
ret = AVERROR(EAGAIN); return AVERROR(EAGAIN);
break; break;
} }
out_frame->frame->pts = av_rescale_q(out_frame->surface.Data.TimeStamp, out_frame->frame->pts = av_rescale_q(out_frame->surface.Data.TimeStamp,
@ -864,8 +863,7 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picr
filter_ret = s->filter_frame(outlink, tmp->frame); filter_ret = s->filter_frame(outlink, tmp->frame);
if (filter_ret < 0) { if (filter_ret < 0) {
av_frame_free(&tmp->frame); av_frame_free(&tmp->frame);
ret = filter_ret; return filter_ret;
break;
} }
tmp->queued--; tmp->queued--;
@ -874,5 +872,10 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picr
} }
} while(ret == MFX_ERR_MORE_SURFACE); } while(ret == MFX_ERR_MORE_SURFACE);
return ret; if (ret < 0)
return ff_qsvvpp_print_error(ctx, ret, "Error running VPP");
else if (ret > 0)
ff_qsvvpp_print_warning(ctx, ret, "Warning in running VPP");
return 0;
} }