avcodec/h264_slice: sync User Data Unregistered SEI buffers across threads

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2020-09-17 13:36:15 -03:00
parent 449984445e
commit 184fc42b46

View File

@ -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(*h->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;