Commit b409748b authored by Ivan Uskov's avatar Ivan Uskov Committed by Michael Niedermayer

libavcodec/qsvenc.c: fix incorrect loop condition.

For example, the encoder may return MFX_WRN_INCOMPATIBLE_VIDEO_PARAM warning
i.e. ret==5 old loop implementation will repeat several times until output buffer
overflow. New implementation explicitly uses loop only for device busy case.
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 0054d5ac
...@@ -399,9 +399,12 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q, ...@@ -399,9 +399,12 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q,
do { do {
ret = MFXVideoENCODE_EncodeFrameAsync(q->session, NULL, surf, &bs, &sync); ret = MFXVideoENCODE_EncodeFrameAsync(q->session, NULL, surf, &bs, &sync);
if (ret == MFX_WRN_DEVICE_BUSY) if (ret == MFX_WRN_DEVICE_BUSY) {
av_usleep(1); av_usleep(1);
} while (ret > 0); continue;
}
break;
} while ( 1 );
if (ret < 0) if (ret < 0)
return (ret == MFX_ERR_MORE_DATA) ? 0 : ff_qsv_error(ret); return (ret == MFX_ERR_MORE_DATA) ? 0 : ff_qsv_error(ret);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment