Commit 8540c00f1b for ffmpeg

commit 8540c00f1bdbf85d62bfa521aa8ae8880a727fb1
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Tue Oct 20 15:57:12 2026 +0200

    avcodec/hevc: keep the active VPS when clearing a layer's SPS

    set_sps() with a NULL SPS released s->vps before returning, also when only
    a non-base layer was cleared while the base layer keeps decoding. The next
    base-layer frame then dereferenced the NULL VPS in ff_hevc_is_alpha_video().
    Release s->vps only when a new SPS is installed alongside it.

    Assisted-by: Fairy
    Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index 14fdadc7cc..f5f0cf7f10 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -768,6 +768,8 @@ static int set_sps(HEVCContext *s, HEVCLayerContext *l, const HEVCSPS *sps)
     if (!sps)
         return 0;

+    av_refstruct_unref(&s->vps);
+
     ret = pic_arrays_init(l, sps);
     if (ret < 0)
         goto fail;