And ensure the buffer is synced between threads. Signed-off-by: James Almer <jamr...@gmail.com> --- libavcodec/h264_picture.c | 2 +- libavcodec/h264_slice.c | 2 ++ libavcodec/h264dec.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c index 371a794ec2..d07c3a0af8 100644 --- a/libavcodec/h264_picture.c +++ b/libavcodec/h264_picture.c @@ -215,7 +215,7 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup) err = AVERROR_INVALIDDATA; if (sd) { // a decoding error may have happened before the side data could be allocated if (!h->h274db) { - h->h274db = av_mallocz(sizeof(*h->h274db)); + h->h274db = ff_refstruct_allocz(sizeof(*h->h274db)); if (!h->h274db) return AVERROR(ENOMEM); } diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 84595b1a8b..b88545a075 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -445,6 +445,8 @@ int ff_h264_update_thread_context(AVCodecContext *dst, h->sei.common.mastering_display = h1->sei.common.mastering_display; h->sei.common.content_light = h1->sei.common.content_light; + ff_refstruct_replace(&h->h274db, h1->h274db); + if (!h->cur_pic_ptr) return 0; diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index af0913ca2c..805732057a 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -156,7 +156,7 @@ void ff_h264_free_tables(H264Context *h) av_freep(&h->mb2b_xy); av_freep(&h->mb2br_xy); - av_freep(&h->h274db); + ff_refstruct_unref(&h->h274db); ff_refstruct_pool_uninit(&h->qscale_table_pool); ff_refstruct_pool_uninit(&h->mb_type_pool); -- 2.47.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".