History

avcodec/decode: sync initial_pict_type and intra_only_flag with thread worker's avctx

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.

James Almer committed 1 year ago

Commit e322e2e1 parent 61c50402 files · +2 −11Browse files

Unified · Split

2 files
  1. libavcodec/decode.c +2 −0
  2. libavcodec/pthread_frame.c +0 −11
libavcodec/decode.c+2−0
@@ -2235,6 +2235,8 @@ void ff_decode_internal_sync(AVCodecContext *dst, const AVCodecContext *src) · 2234 unmodified lines
2235 const DecodeContext *src_dc = decode_ctx(src->internal);2235 const DecodeContext *src_dc = decode_ctx(src->internal);
2236 DecodeContext *dst_dc = decode_ctx(dst->internal);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 av_refstruct_replace(&dst_dc->lcevc, src_dc->lcevc);2240 av_refstruct_replace(&dst_dc->lcevc, src_dc->lcevc);
2239}2241}
2240 2242
libavcodec/pthread_frame.c+0−11
@@ -115,10 +115,6 @@ typedef struct PerThreadContext { · 114 unmodified lines
115 int hwaccel_threadsafe;115 int hwaccel_threadsafe;
116 116
117 atomic_int debug_threads; ///< Set if the FF_DEBUG_THREADS option is set.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} PerThreadContext;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 AVCodecContext *copy;816 AVCodecContext *copy;
821 int err;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 atomic_init(&p->state, STATE_INPUT_READY);819 atomic_init(&p->state, STATE_INPUT_READY);
831 820
832 copy = av_memdup(avctx, sizeof(*avctx));821 copy = av_memdup(avctx, sizeof(*avctx));

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t