Commit aae07419 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

picture: inline and relax picture_Hold()

Relaxed memory order cannot work with an external function.
parent fc809b3a
......@@ -32,6 +32,8 @@
#else
#include <atomic>
using std::atomic_uintptr_t;
using std::memory_order;
using std::memory_order_relaxed;
#endif
/**
......@@ -166,12 +168,16 @@ typedef struct
VLC_API picture_t * picture_NewFromResource( const video_format_t *, const picture_resource_t * ) VLC_USED;
/**
* This function will increase the picture reference count.
* It will not have any effect on picture obtained from vout
* Increments the picture reference count.
*
* It returns the given picture for convenience.
* \return picture
*/
VLC_API picture_t *picture_Hold( picture_t *p_picture );
static inline picture_t *picture_Hold(picture_t *picture)
{
atomic_fetch_add_explicit(&picture->refs, (uintptr_t)1,
memory_order_relaxed);
return picture;
}
/**
* This function will release a picture.
......
......@@ -298,7 +298,6 @@ NTPtime64
picture_BlendSubpicture
picture_Clone
picture_CopyPixels
picture_Hold
picture_Release
picture_CopyProperties
picture_Copy
......
......@@ -320,15 +320,6 @@ picture_t *picture_New( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_
*
*****************************************************************************/
picture_t *picture_Hold( picture_t *p_picture )
{
assert( p_picture != NULL );
uintptr_t refs = atomic_fetch_add(&p_picture->refs, 1);
assert( refs > 0 );
return p_picture;
}
void picture_Release( picture_t *p_picture )
{
assert( p_picture != NULL );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment