diff options
author | Ivan Uskov <ivan.uskov@nablet.com> | 2015-07-07 20:33:36 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-07-09 02:25:39 +0200 |
commit | b409748bc4412fa2d8e642585c4e5ab8a4d136cb (patch) | |
tree | f0fd47b4a642ad79470f9642cbe4d2a0e0fcf234 /libavcodec/qsvenc.c | |
parent | 0054d5ac02eaf37d7cfa63efa6e278b5f749c0c6 (diff) | |
download | ffmpeg-b409748bc4412fa2d8e642585c4e5ab8a4d136cb.tar.gz |
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: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/qsvenc.c')
-rw-r--r-- | libavcodec/qsvenc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index dc8b5f238a..066662410c 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -399,9 +399,12 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q, do { ret = MFXVideoENCODE_EncodeFrameAsync(q->session, NULL, surf, &bs, &sync); - if (ret == MFX_WRN_DEVICE_BUSY) + if (ret == MFX_WRN_DEVICE_BUSY) { av_usleep(1); - } while (ret > 0); + continue; + } + break; + } while ( 1 ); if (ret < 0) return (ret == MFX_ERR_MORE_DATA) ? 0 : ff_qsv_error(ret); |