[FFmpeg-devel] [PATCH v2] avcodec/h264_slice: sync User Data Unregistered SEI buffers across threads
James Almer
jamrial at gmail.com
Thu Sep 17 20:06:52 EEST 2020
Signed-off-by: James Almer <jamrial at gmail.com>
---
Now it also updates the x264_build field.
libavcodec/h264_slice.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index cfc29e186c..f091cd4dc1 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -439,6 +439,26 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
return AVERROR(ENOMEM);
}
+ for (i = 0; i < h->sei.unregistered.nb_buf_ref; i++)
+ av_buffer_unref(&h->sei.unregistered.buf_ref[i]);
+ h->sei.unregistered.nb_buf_ref = 0;
+
+ if (h1->sei.unregistered.nb_buf_ref) {
+ ret = av_reallocp_array(&h->sei.unregistered.buf_ref,
+ h1->sei.unregistered.nb_buf_ref,
+ sizeof(*h1->sei.unregistered.buf_ref));
+ if (ret < 0)
+ return ret;
+
+ for (i = 0; i < h1->sei.unregistered.nb_buf_ref; i++) {
+ h->sei.unregistered.buf_ref[i] = av_buffer_ref(h1->sei.unregistered.buf_ref[i]);
+ if (!h->sei.unregistered.buf_ref[i])
+ return AVERROR(ENOMEM);
+ h->sei.unregistered.nb_buf_ref++;
+ }
+ }
+ h->sei.unregistered.x264_build = h1->sei.unregistered.x264_build;
+
if (!h->cur_pic_ptr)
return 0;
--
2.27.0
More information about the ffmpeg-devel
mailing list