[FFmpeg-devel] [PATCH] lavc/qsv: skip the packet if decoding failure.

Jun Zhao mypopydev at gmail.com
Fri Jan 26 07:02:02 EET 2018



On 2018/1/25 16:37, Ruiling Song wrote:
> From: "Ruiling, Song" <ruiling.song at intel.com>
>
> MediaSDK may fail to decode some frame, just skip it.
> Otherwise, it will keep decoding the failure packet repeatedly
> without processing any packet afterwards.
>
> v2:
> switch to using av_packet_unref().
>
> Signed-off-by: Ruiling Song <ruiling.song at intel.com>
> ---
>  libavcodec/qsvdec_h2645.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/qsvdec_h2645.c b/libavcodec/qsvdec_h2645.c
> index 5e00673..d92a150 100644
> --- a/libavcodec/qsvdec_h2645.c
> +++ b/libavcodec/qsvdec_h2645.c
> @@ -153,8 +153,12 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data,
>          }
>  
>          ret = ff_qsv_process_data(avctx, &s->qsv, frame, got_frame, &s->buffer_pkt);
> -        if (ret < 0)
> +        if (ret < 0) {
> +            /* Drop buffer_pkt when failed to decode the packet. Otherwise,
> +               the decoder will keep decoding the failure packet. */
> +            av_packet_unref(&s->buffer_pkt);

I think add a warning message more better than only drop the packet on
the quiet. 

>              return ret;
> +        }
>  
>          s->buffer_pkt.size -= ret;
>          s->buffer_pkt.data += ret;



More information about the ffmpeg-devel mailing list