File 11013-avcodec-decode-clean-up-if-get_hw_frames_parameters-.patch of Package ffmpeg-7

28
 
1
From: François Cartegnie <fcvlcdev@free.fr>
2
Date: Mon, 13 May 2024 11:37:27 +0000
3
Subject: avcodec/decode: clean-up if get_hw_frames_parameters fails
4
5
https://trac.ffmpeg.org/ticket/11013
6
https://code.videolan.org/videolan/vlc/-/issues/28811
7
8
Fixes the following assert:
9
10
[00007f1df83d17e0] vaapi generic error: avcodec_get_hw_frames_parameters failed: -22
11
Assertion p_dst->hwaccel_threadsafe || (!dst->hwaccel && !dst->internal->hwaccel_priv_data) failed at libavcodec/pthread_frame.c:349
12
13
Reproduced from VLC with VAAPI, when fallbacking from hw to sw.
14
15
--- a/libavcodec/pthread_frame.c
16
+++ b/libavcodec/pthread_frame.c
17
@@ -344,6 +344,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
18
                 return err;
19
         }
20
 
21
+       // hwaccel could have failed init due to some params
22
+       if(!dst->hwaccel && dst->internal->hwaccel_priv_data)
23
+           ff_hwaccel_uninit(dst);
24
+
25
         // reset dst hwaccel state if needed
26
         av_assert0(p_dst->hwaccel_threadsafe ||
27
                    (!dst->hwaccel && !dst->internal->hwaccel_priv_data));
28