From: Ting Hu <siriushu-at-hotmail.com@ffmpeg.org> To: ffmpeg-devel@ffmpeg.org Cc: tinghu3 <siriushu@hotmail.com> Subject: [FFmpeg-devel] [PATCH v3 1/1] lavc/qsvdec: fix dead loop of qsv decoding Date: Mon, 18 Sep 2023 15:59:46 +0800 Message-ID: <TYCP286MB214821644BB95F9636A3AF42D5FBA@TYCP286MB2148.JPNP286.PROD.OUTLOOK.COM> (raw) In-Reply-To: <20230829074906.9345-1-siriushu@hotmail.com> From: tinghu3 <siriushu@hotmail.com> MFXVideoDECODE_DecodeFrameAsync always returns MFX_WRN_DEVICE_BUSY in special scenario. Client side received and decoded more than 9 video streams with different resolution in video conference call. Related to bug: https://github.com/oneapi-src/oneVPL-intel-gpu/issues/299 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".
parent reply other threads:[~2023-09-18 8:00 UTC|newest] Thread overview: expand[flat|nested] mbox.gz Atom feed [parent not found: <20230829074906.9345-1-siriushu@hotmail.com>]
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=TYCP286MB214821644BB95F9636A3AF42D5FBA@TYCP286MB2148.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