From patchwork Sat Mar 25 23:51:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 3100 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.50.79 with SMTP id y76csp661764vsy; Sat, 25 Mar 2017 16:52:01 -0700 (PDT) X-Received: by 10.28.130.139 with SMTP id e133mr3777340wmd.133.1490485921343; Sat, 25 Mar 2017 16:52:01 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v2si8896307wrv.127.2017.03.25.16.52.01; Sat, 25 Mar 2017 16:52:01 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B826F68829F; Sun, 26 Mar 2017 01:51:32 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E10A26804D7 for ; Sun, 26 Mar 2017 01:51:25 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 1B9F8102DCE; Sun, 26 Mar 2017 00:51:47 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Bm-lJAXVC1gD; Sun, 26 Mar 2017 00:51:46 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id DDE27100B39; Sun, 26 Mar 2017 00:51:45 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 26 Mar 2017 00:51:36 +0100 Message-Id: <20170325235137.5330-2-cus@passwd.hu> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170325235137.5330-1-cus@passwd.hu> References: <20170325235137.5330-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 2/3] avdevice/decklink_enc: convert to std::atomic 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 Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Marton Balint --- libavdevice/decklink_enc.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp index 8892d19..18ef905 100644 --- a/libavdevice/decklink_enc.cpp +++ b/libavdevice/decklink_enc.cpp @@ -19,6 +19,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include +using std::atomic; + #include #include @@ -28,7 +31,6 @@ extern "C" { #include "libavformat/avformat.h" #include "libavformat/internal.h" #include "libavutil/imgutils.h" -#include "libavutil/atomic.h" } #include "decklink_common.h" @@ -60,10 +62,10 @@ public: virtual HRESULT STDMETHODCALLTYPE GetAncillaryData(IDeckLinkVideoFrameAncillary **ancillary) { return S_FALSE; } virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; } - virtual ULONG STDMETHODCALLTYPE AddRef(void) { return avpriv_atomic_int_add_and_fetch(&_refs, 1); } + virtual ULONG STDMETHODCALLTYPE AddRef(void) { return ++_refs; } virtual ULONG STDMETHODCALLTYPE Release(void) { - int ret = avpriv_atomic_int_add_and_fetch(&_refs, -1); + int ret = --_refs; if (!ret) { av_frame_free(&_avframe); delete this; @@ -75,7 +77,7 @@ public: AVFrame *_avframe; private: - volatile int _refs; + std::atomic _refs; }; class decklink_output_callback : public IDeckLinkVideoOutputCallback