vlc | branch: master | Romain Vimont <ro...@videolabs.io> | Thu Jul  5 10:30:52 
2018 +0200| [0fd485e7a10f7b594d1e4bd81f7bb6562e03f3da] | committer: Steve Lhomme

core: use refcounter helper for vt_utils

Signed-off-by: Steve Lhomme <rob...@ycbcr.xyz>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0fd485e7a10f7b594d1e4bd81f7bb6562e03f3da
---

 modules/codec/vt_utils.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/codec/vt_utils.c b/modules/codec/vt_utils.c
index 1c62d7d3cf..6c915d802f 100644
--- a/modules/codec/vt_utils.c
+++ b/modules/codec/vt_utils.c
@@ -22,7 +22,7 @@
 # include "config.h"
 #endif
 
-#include <stdatomic.h>
+#include <vlc_atomic.h>
 
 #include "vt_utils.h"
 
@@ -48,7 +48,7 @@ struct cvpxpic_ctx
     CVPixelBufferRef cvpx;
     unsigned nb_fields;
 
-    atomic_uint ref_count;
+    vlc_atomic_rc_t rc;
     void (*on_released_cb)(CVPixelBufferRef, void *, unsigned);
     void *on_released_data;
 };
@@ -58,7 +58,7 @@ cvpxpic_destroy_cb(picture_context_t *opaque)
 {
     struct cvpxpic_ctx *ctx = (struct cvpxpic_ctx *)opaque;
 
-    if (atomic_fetch_sub(&ctx->ref_count, 1) == 1)
+    if (vlc_atomic_rc_dec(&ctx->rc))
     {
         CFRelease(ctx->cvpx);
         if (ctx->on_released_cb)
@@ -71,7 +71,7 @@ static picture_context_t *
 cvpxpic_copy_cb(struct picture_context_t *opaque)
 {
     struct cvpxpic_ctx *ctx = (struct cvpxpic_ctx *)opaque;
-    atomic_fetch_add(&ctx->ref_count, 1);
+    vlc_atomic_rc_inc(&ctx->rc);
     return opaque;
 }
 

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to