From patchwork Thu Sep 17 17:06:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 22460 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id D03DF44B4D5 for ; Thu, 17 Sep 2020 20:07:28 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AA81068B90D; Thu, 17 Sep 2020 20:07:28 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f68.google.com (mail-qv1-f68.google.com [209.85.219.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8948B68B8CF for ; Thu, 17 Sep 2020 20:07:21 +0300 (EEST) Received: by mail-qv1-f68.google.com with SMTP id di5so1328187qvb.13 for ; Thu, 17 Sep 2020 10:07:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ehpvD5q9SnlbuH26JlE9aopbSyA1RO1oFGaNqQtHjyk=; b=EFjtVtp6Y3vUeS5vEtCuBX9+12NMCRSJrtX2Q5gT0NcJgeIk07mBT8sovXPD/czKUI mcR+HvEF/fZ8wSphfTU3VygpJZaoH81Lxy0W0hn1nrbNRF29gR+gYosFaM4kVWkdjcLQ 1/T9icnEf7uyfFgdozDJ5dtDzstbhYB3YWYJhRfY6b/EAFj5wDDJ+0BkfZG1KnV29Mre yX5jH4BrAV8upHl5wEF7nQw38v3/raPPuqClcSseavqDz3CWxHDUgiieGPTSM0XDVEH1 aEVagMjHA6WbaCrXy++aVfFII+UVLAXZe0lf9LhdcyH9xP+ezlzZ8MozXbxLGLkPcuBo FI0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ehpvD5q9SnlbuH26JlE9aopbSyA1RO1oFGaNqQtHjyk=; b=oPQj8K6aJmzCAhW2PgIOsabO1LI7evfvUB3o/N/wAGh1OIPzbErRD1+QSyv9QHhSZ1 jAA8ennVzrROHXxKPKUrpf/Po8tfEKQAqY7TKgVzWgONG1wNQoVCBq8DICksovtyT7WK tRAOdqGlb5PzJkfgYITW6Vu1U5oNk+XJkukSY+QeS1B4gfMI391KTZwyYSKsDKS1qzuc KkbLduhqneq/As+Qn4wnGtUV/cVZxyeOZKP4bLK6ncKGzOVqTc2o75ra+/z8PDgr9Dbv Q2hFhKcSQ1ZcueBFblg1iHgipCFZXxHx3fsS+bbkZ4giygm/drGFotM6fJeMD3AP000g TcnQ== X-Gm-Message-State: AOAM530gNC06Qo67TADej4HfeatUdv1SAPpdX3uztjRMtoW79xT6BCti eEUWXe6IlKlAQAv+FPBGgGLsFJNAuEcfYw== X-Google-Smtp-Source: ABdhPJznyYzo/3+UBIrN8T4uiy6hC+478hogZJaYhqRi3sFaU9+aJwlSAR+kRTGHcbyvYghJLRs8sQ== X-Received: by 2002:a0c:c98d:: with SMTP id b13mr29250039qvk.1.1600362439788; Thu, 17 Sep 2020 10:07:19 -0700 (PDT) Received: from localhost.localdomain ([191.83.208.67]) by smtp.gmail.com with ESMTPSA id t26sm264421qkt.29.2020.09.17.10.07.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2020 10:07:18 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 17 Sep 2020 14:06:52 -0300 Message-Id: <20200917170652.6524-1-jamrial@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200917164304.6469-1-jamrial@gmail.com> References: <20200917164304.6469-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] avcodec/h264_slice: sync User Data Unregistered SEI buffers across threads X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: James Almer --- 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;