This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit e5eb7581ddc511a46892b5501b26fb831161b5da Author: Kacper Michajłow <[email protected]> AuthorDate: Tue Aug 25 01:37:59 2026 +0200 Commit: Kacper Michajłow <[email protected]> CommitDate: Tue Sep 8 03:17:20 2026 +0000 avcodec/hevc: don't error out on remaining slices of a skipped picture When the first slice of a picture is skipped, an undecodable RASL after a seek or avctx->skip_frame, the remaining slices were still parsed against the stale context and failed the PPS change, dependent slice, or missing first slice checks, logging a decoding error per slice. Drop them before parsing instead. Signed-off-by: Kacper Michajłow <[email protected]> --- libavcodec/hevc/hevcdec.c | 11 +++++++++++ libavcodec/hevc/hevcdec.h | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index 475c2738b1..d92e968a98 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -3559,6 +3559,11 @@ static int decode_slice(HEVCContext *s, unsigned nal_idx, GetBitContext *gb) (s->nuh_layer_id > 0 && !(s->layers_active_decode & (1 << layer_idx)))) return 0; + // the first slice of this picture was skipped, so drop the remaining + // slices before parsing, the context is stale for them + if (s->skipping_frame && !show_bits1(gb)) + return 0; + ret = hls_slice_header(&s->sh, s, gb); // Once hls_slice_header has been called, the context is inconsistent with the slice header // until the context is reinitialized according to the contents of the new slice header @@ -3573,8 +3578,12 @@ static int decode_slice(HEVCContext *s, unsigned nal_idx, GetBitContext *gb) (s->avctx->skip_frame >= AVDISCARD_NONKEY && !IS_IRAP(s)) || ((s->nal_unit_type == HEVC_NAL_RASL_R || s->nal_unit_type == HEVC_NAL_RASL_N) && s->no_rasl_output_flag)) { + if (s->sh.first_slice_in_pic_flag) + s->skipping_frame = 1; return 0; } + if (s->sh.first_slice_in_pic_flag) + s->skipping_frame = 0; // switching to a new layer, mark previous layer's frame (if any) as done if (s->cur_layer != layer_idx && @@ -4076,6 +4085,7 @@ static int hevc_update_thread_context(AVCodecContext *dst, s->poc_tid0 = s0->poc_tid0; s->eos = s0->eos; s->no_rasl_output_flag = s0->no_rasl_output_flag; + s->skipping_frame = s0->skipping_frame; s->is_nalff = s0->is_nalff; s->nal_length_size = s0->nal_length_size; @@ -4221,6 +4231,7 @@ static av_cold void hevc_decode_flush(AVCodecContext *avctx) ff_dovi_ctx_flush(&s->dovi_ctx); av_buffer_unref(&s->rpu_buf); s->eos = 1; + s->skipping_frame = 0; if (FF_HW_HAS_CB(avctx, flush)) FF_HW_SIMPLE_CALL(avctx, flush); diff --git a/libavcodec/hevc/hevcdec.h b/libavcodec/hevc/hevcdec.h index 8394740c4b..b21d82b5c6 100644 --- a/libavcodec/hevc/hevcdec.h +++ b/libavcodec/hevc/hevcdec.h @@ -531,6 +531,10 @@ typedef struct HEVCContext { // NoRaslOutputFlag associated with the last IRAP frame int no_rasl_output_flag; + // The first slice of the current picture was skipped (undecodable RASL + // or avctx->skip_frame), so drop its remaining slices too + int skipping_frame; + HEVCPredContext hpc; HEVCDSPContext hevcdsp; VideoDSPContext vdsp; -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
