[FFmpeg-devel] [PATCH]lavc/hevcdec: Treat clean random access nals as keyframes for -skip_frame

Mark Thompson sw at jkqxz.net
Sat May 26 19:38:41 EEST 2018


On 24/05/18 17:57, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes ticket #7227 here, -skip_frame nokey shows no
> warnings on decoding with this change and still decodes less frames
> than -skip_frame nointra (which shows many warnings).
> 
> Please comment, Carl Eugen
> 
> 
> From ea5cf5aab2a9360971f5291fce19e5daae833de0 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <ceffmpeg at gmail.com>
> Date: Thu, 24 May 2018 18:53:16 +0200
> Subject: [PATCH] lavc/hevcdec: Treat clean random access nals as keyframes
>  for -skip_frame.
> 
> Fixes ticket #7227.
> ---
>  libavcodec/hevcdec.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> index c887762..dd7675a 100644
> --- a/libavcodec/hevcdec.c
> +++ b/libavcodec/hevcdec.c
> @@ -2919,7 +2919,7 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
>          if (
>              (s->avctx->skip_frame >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) ||
>              (s->avctx->skip_frame >= AVDISCARD_NONINTRA && s->sh.slice_type != HEVC_SLICE_I) ||
> -            (s->avctx->skip_frame >= AVDISCARD_NONKEY && !IS_IDR(s))) {
> +            (s->avctx->skip_frame >= AVDISCARD_NONKEY && !IS_IDR(s) && s->nal_unit_type != HEVC_NAL_CRA_NUT)) {

I think "!IS_IRAP(s)" would be simpler and perhaps more consistent?  (Compared to what you have here it adds BLA NAL units as well, which will be equivalent to CRA for this purpose.)

>              break;
>          }
>  
> -- 
> 1.7.10.4
> 

Should be fine with or without that change.

Thanks,

- Mark


More information about the ffmpeg-devel mailing list