Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Xiang, Haihao" <haihao.xiang-at-intel.com@ffmpeg.org>
To: "ffmpeg-devel@ffmpeg.org" <ffmpeg-devel@ffmpeg.org>
Cc: "siriushu@hotmail.com" <siriushu@hotmail.com>
Subject: Re: [FFmpeg-devel] [PATCH v1 1/1] lavc/qsvdec: fix dead loop of qsv decoding
Date: Mon, 21 Aug 2023 06:20:03 +0000
Message-ID: <b529956c7b00d6c2cf8e14e6e330e212b9262f68.camel@intel.com> (raw)
In-Reply-To: <OSZP286MB2142190D9FF8601673360B2AD51AA@OSZP286MB2142.JPNP286.PROD.OUTLOOK.COM>

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".

      reply	other threads:[~2023-08-21  6:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-17 11:39 Ting Hu
2023-08-21  6:20 ` Xiang, Haihao [this message]

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=b529956c7b00d6c2cf8e14e6e330e212b9262f68.camel@intel.com \
    --to=haihao.xiang-at-intel.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