[FFmpeg-devel] [PATCH] avcodec/h264_slice: sync User Data Unregistered SEI buffers across threads
James Almer
jamrial at gmail.com
Thu Sep 17 19:43:04 EEST 2020
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavcodec/h264_slice.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index cfc29e186c..bb95a92792 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -439,6 +439,25 @@ 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++;
+ }
+ }
+
if (!h->cur_pic_ptr)
return 0;
--
2.27.0
More information about the ffmpeg-devel
mailing list