diff options
author | Anton Khirnov <anton@khirnov.net> | 2015-05-09 21:54:47 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2015-06-27 16:48:48 +0200 |
commit | 5ec0bdf2c524224f30ba4786f47324970aed4aaa (patch) | |
tree | 7135febfa2d57e90a8a7009c4772c7162885f593 /libavcodec/h264.c | |
parent | 6d4d3fee63c46d921c4870feab79269af94e84e1 (diff) | |
download | ffmpeg-5ec0bdf2c524224f30ba4786f47324970aed4aaa.tar.gz |
h264: do not update the context fields copied between threads after finish_setup()
Should fix a large number of possible races with frame threading.
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index e39a119364..6fd238d444 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -950,8 +950,12 @@ static void decode_postinit(H264Context *h, int setup_finished) h->next_output_pic->recovered |= !!(h->frame_recovered & FRAME_RECOVERED_SEI); } - if (setup_finished && !h->avctx->hwaccel) + if (setup_finished && !h->avctx->hwaccel) { ff_thread_finish_setup(h->avctx); + + if (h->avctx->active_thread_type & FF_THREAD_FRAME) + h->setup_finished = 1; + } } int ff_pred_weight_table(H264Context *h, H264SliceContext *sl) @@ -1618,6 +1622,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data, int ret; h->flags = avctx->flags; + h->setup_finished = 0; /* end of stream, output what is still in the buffers */ out: |