Regression since 5acbdd2264d3b90dc11369f9e031e762f260882e, which removed setting both values from PerThreadContext. Given the pthread code calls ff_decode_receive_frame_internal() on the frame, any value set before it will be overwritten, so instead sync each thread's DecodeContext and let ff_decode_receive_frame_internal() handle these values. Fixes issue #20534.
Unified · Split
| @@ -2235,6 +2235,8 @@ void ff_decode_internal_sync(AVCodecContext *dst, const AVCodecContext *src) · 2234 unmodified lines | ||
| 2235 | 2235 | const DecodeContext *src_dc = decode_ctx(src->internal); |
| 2236 | 2236 | DecodeContext *dst_dc = decode_ctx(dst->internal); |
| 2237 | 2237 | |
| 2238 | + dst_dc->initial_pict_type = src_dc->initial_pict_type; | |
| 2239 | + dst_dc->intra_only_flag = src_dc->intra_only_flag; | |
| 2238 | 2240 | av_refstruct_replace(&dst_dc->lcevc, src_dc->lcevc); |
| 2239 | 2241 | } |
| 2240 | 2242 | |
| @@ -115,10 +115,6 @@ typedef struct PerThreadContext { · 114 unmodified lines | ||
| 115 | 115 | int hwaccel_threadsafe; |
| 116 | 116 | |
| 117 | 117 | atomic_int debug_threads; ///< Set if the FF_DEBUG_THREADS option is set. |
| 118 | − | |
| 119 | − /// The following two fields have the same semantics as the DecodeContext field | |
| 120 | − int intra_only_flag; | |
| 121 | − enum AVPictureType initial_pict_type; | |
| 122 | 118 | } PerThreadContext; |
| 123 | 119 | |
| 124 | 120 | /** |
| @@ -820,13 +816,6 @@ static av_cold int init_thread(PerThreadContext *p, int *threads_to_free, · 695 unmodified lines | ||
| 820 | 816 | AVCodecContext *copy; |
| 821 | 817 | int err; |
| 822 | 818 | |
| 823 | − p->initial_pict_type = AV_PICTURE_TYPE_NONE; | |
| 824 | − if (avctx->codec_descriptor->props & AV_CODEC_PROP_INTRA_ONLY) { | |
| 825 | − p->intra_only_flag = AV_FRAME_FLAG_KEY; | |
| 826 | − if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) | |
| 827 | − p->initial_pict_type = AV_PICTURE_TYPE_I; | |
| 828 | − } | |
| 829 | − | |
| 830 | 819 | atomic_init(&p->state, STATE_INPUT_READY); |
| 831 | 820 | |
| 832 | 821 | copy = av_memdup(avctx, sizeof(*avctx)); |