[FFmpeg-cvslog] avcodec/h264_slice: sync User Data Unregistered SEI buffers across threads

James Almer git at videolan.org
Wed Sep 23 16:23:56 EEST 2020


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Sep 17 13:36:15 2020 -0300| [184fc42b46cb6068af2735d4d888b3254c2db652] | committer: James Almer

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

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=184fc42b46cb6068af2735d4d888b3254c2db652
---

 libavcodec/h264_slice.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index cfc29e186c..db7302a8b5 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(*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;
 



More information about the ffmpeg-cvslog mailing list