From: Ting Hu <siriushu-at-hotmail.com@ffmpeg.org> To: ffmpeg-devel@ffmpeg.org Cc: tinghu3 <siriushu@hotmail.com> Subject: [FFmpeg-devel] [PATCH v2 1/1] lavc/qsvdec: fix dead loop of qsv decoding Date: Tue, 29 Aug 2023 15:49:06 +0800 Message-ID: <OSZP286MB214217936FF2CDDD56722971D5E7A@OSZP286MB2142.JPNP286.PROD.OUTLOOK.COM> (raw) From: tinghu3 <siriushu@hotmail.com> MFXVideoDECODE_DecodeFrameAsync always return MFX_WRN_DEVICE_BUSY in special scenario. Signed-off-by: tinghu3 <siriushu@hotmail.com> --- libavcodec/qsvdec.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index da700f25e9..6286612ce6 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -703,6 +703,7 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext *q, mfxSyncPoint *sync; mfxBitstream bs = { { { 0 } } }; int ret; + int max_count = 0; if (avpkt->size) { bs.Data = avpkt->data; @@ -728,9 +729,18 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext *q, ret = MFXVideoDECODE_DecodeFrameAsync(q->session, avpkt->size ? &bs : NULL, insurf, &outsurf, sync); - if (ret == MFX_WRN_DEVICE_BUSY) + if (ret == MFX_WRN_DEVICE_BUSY) { + /* Check the max wait time 500ms to avoid dead loop */ + if (++max_count == 1000) { + av_log(avctx, AV_LOG_ERROR, + "MFX decoder returns device busy that reachs timeout 500ms \n"); + av_freep(&sync); + return AVERROR(EBUSY); + } av_usleep(500); - + } else if (ret == MFX_ERR_MORE_SURFACE) { + max_count = 0; + } } while (ret == MFX_WRN_DEVICE_BUSY || ret == MFX_ERR_MORE_SURFACE); if (ret == MFX_ERR_INCOMPATIBLE_VIDEO_PARAM) { -- 2.38.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2023-08-29 7:51 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-08-29 7:49 Ting Hu [this message] 2023-08-29 7:57 Anton Khirnov 2023-08-31 1:34 ` sirius hu 2023-09-14 6:11 ` Xiang, Haihao 2023-09-14 7:08 ` "zhilizhao(赵志立)" 2023-10-16 8:26 ` Xiang, Haihao 2023-09-15 6:36 ` sirius hu
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=OSZP286MB214217936FF2CDDD56722971D5E7A@OSZP286MB2142.JPNP286.PROD.OUTLOOK.COM \ --to=siriushu-at-hotmail.com@ffmpeg.org \ --cc=ffmpeg-devel@ffmpeg.org \ --cc=siriushu@hotmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git