From 6d2ab24bcd9bce1886e81f2189844f1fd98dcbad Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Fri, 11 Apr 2025 10:52:01 +0200 Subject: [PATCH] vdec/lavc: fix H.265 decode with intra-refresh Fix decoding of HEVC streams with intra-refresh and current Git FFmpeg code. When intra-refresh is enabled and we are not catching the first frame, no frame will be decoded without the flag AV_CODEC_FLAG_OUTPUT_CORRUPT. This corresponds with FFmpeg commit bc1a3bfd (2025-02-20), not yet included in current 7.1.1 / lavc 61, should appear in lavc 62. Steps to reproduce: ``` uv -t testcard -c lavc:e=libx265 -d gl ``` --- src/video_decompress/libavcodec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/video_decompress/libavcodec.c b/src/video_decompress/libavcodec.c index 6dbdc9d0b..7ffa2c576 100644 --- a/src/video_decompress/libavcodec.c +++ b/src/video_decompress/libavcodec.c @@ -213,6 +213,7 @@ set_codec_context_params(struct state_libavcodec_decompress *s) bool req_low_delay = true; set_thread_count(s, &req_low_delay); + s->codec_ctx->flags |= AV_CODEC_FLAG_OUTPUT_CORRUPT; s->codec_ctx->flags |= req_low_delay ? AV_CODEC_FLAG_LOW_DELAY : 0; s->codec_ctx->flags2 |= AV_CODEC_FLAG2_FAST; // set by decoder