* [FFmpeg-devel] [PATCH v1 1/1] lavc/qsvdec: fix dead loop of qsv decoding
@ 2023-08-17 11:39 Ting Hu
2023-08-21 6:20 ` Xiang, Haihao
0 siblings, 1 reply; 2+ messages in thread
From: Ting Hu @ 2023-08-17 11:39 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: tinghu3
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 | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index da700f25e9..35102fb476 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;
@@ -730,7 +731,9 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext *q,
insurf, &outsurf, sync);
if (ret == MFX_WRN_DEVICE_BUSY)
av_usleep(500);
-
+ /* Check the max wait time 500ms to avoid dead loop */
+ if (++max_count == 1000)
+ return ret;
} 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".
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH v1 1/1] lavc/qsvdec: fix dead loop of qsv decoding
2023-08-17 11:39 [FFmpeg-devel] [PATCH v1 1/1] lavc/qsvdec: fix dead loop of qsv decoding Ting Hu
@ 2023-08-21 6:20 ` Xiang, Haihao
0 siblings, 0 replies; 2+ messages in thread
From: Xiang, Haihao @ 2023-08-21 6:20 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: siriushu
On Do, 2023-08-17 at 19:39 +0800, Ting Hu wrote:
> 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 | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
> index da700f25e9..35102fb476 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;
> @@ -730,7 +731,9 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext
> *q,
> insurf, &outsurf, sync);
> if (ret == MFX_WRN_DEVICE_BUSY)
> av_usleep(500);
> -
> + /* Check the max wait time 500ms to avoid dead loop */
> + if (++max_count == 1000)
Check the max wait time only for MFX_WRN_DEVICE_BUSY, and reset max_count to 0
when ret is not MFX_WRN_DEVICE_BUSY.
> + return ret;
Don't return MFX_WRN_xxx from this function.
Thanks
Haihao
> } while (ret == MFX_WRN_DEVICE_BUSY || ret == MFX_ERR_MORE_SURFACE);
>
> if (ret == MFX_ERR_INCOMPATIBLE_VIDEO_PARAM) {
_______________________________________________
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".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-21 6:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-17 11:39 [FFmpeg-devel] [PATCH v1 1/1] lavc/qsvdec: fix dead loop of qsv decoding Ting Hu
2023-08-21 6:20 ` Xiang, Haihao
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