Returning AVERROR(EAGAIN) when libmfx needs more data will cause the failure
of requesting the next frame and lead to an infinite loop.

Sleep for a while to release the resources before calling 
MFXVideoCORE_SyncOperation
in hwupload to avoid the crash (in MCTF for example).

Signed-off-by: Linjie Fu <linjie...@intel.com>
---
 libavfilter/qsvvpp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index 06efdf5089..1a10d16788 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -714,8 +714,10 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink 
*inlink, AVFrame *picr
 
         if (ret < 0 && ret != MFX_ERR_MORE_SURFACE) {
             /* Ignore more_data error */
-            if (ret == MFX_ERR_MORE_DATA)
-                ret = AVERROR(EAGAIN);
+            if (ret == MFX_ERR_MORE_DATA) {
+                ret = MFX_ERR_NONE;
+                av_usleep(100000);
+            }
             break;
         }
 
-- 
2.17.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to