Commit f99ed598 authored by Laurent Aimar's avatar Laurent Aimar

Fixed some missing unlock() in picture_pool.

parent 0eb8d331
...@@ -58,7 +58,9 @@ struct picture_pool_t { ...@@ -58,7 +58,9 @@ struct picture_pool_t {
picture_t **picture; picture_t **picture;
}; };
static void PicturePoolPictureRelease(picture_t *); static void Release(picture_t *);
static int Lock(picture_t *);
static void Unlock(picture_t *);
picture_pool_t *picture_pool_NewExtended(const picture_pool_configuration_t *cfg) picture_pool_t *picture_pool_NewExtended(const picture_pool_configuration_t *cfg)
{ {
...@@ -92,7 +94,7 @@ picture_pool_t *picture_pool_NewExtended(const picture_pool_configuration_t *cfg ...@@ -92,7 +94,7 @@ picture_pool_t *picture_pool_NewExtended(const picture_pool_configuration_t *cfg
/* */ /* */
picture->i_refcount = 0; picture->i_refcount = 0;
picture->pf_release = PicturePoolPictureRelease; picture->pf_release = Release;
picture->p_release_sys = release_sys; picture->p_release_sys = release_sys;
/* */ /* */
...@@ -165,8 +167,7 @@ picture_t *picture_pool_Get(picture_pool_t *pool) ...@@ -165,8 +167,7 @@ picture_t *picture_pool_Get(picture_pool_t *pool)
if (picture->i_refcount > 0) if (picture->i_refcount > 0)
continue; continue;
picture_release_sys_t *release_sys = picture->p_release_sys; if (Lock(picture))
if (release_sys->lock && release_sys->lock(picture))
continue; continue;
/* */ /* */
...@@ -185,7 +186,8 @@ void picture_pool_NonEmpty(picture_pool_t *pool, bool reset) ...@@ -185,7 +186,8 @@ void picture_pool_NonEmpty(picture_pool_t *pool, bool reset)
picture_t *picture = pool->picture[i]; picture_t *picture = pool->picture[i];
if (reset) { if (reset) {
/* TODO pf_unlock */ if (picture->i_refcount > 0)
Unlock(picture);
picture->i_refcount = 0; picture->i_refcount = 0;
} else if (picture->i_refcount == 0) { } else if (picture->i_refcount == 0) {
return; return;
...@@ -194,18 +196,30 @@ void picture_pool_NonEmpty(picture_pool_t *pool, bool reset) ...@@ -194,18 +196,30 @@ void picture_pool_NonEmpty(picture_pool_t *pool, bool reset)
} }
} }
if (!reset && old) { if (!reset && old) {
/* TODO pf_unlock */ if (old->i_refcount > 0)
Unlock(old);
old->i_refcount = 0; old->i_refcount = 0;
} }
} }
static void PicturePoolPictureRelease(picture_t *picture) static void Release(picture_t *picture)
{ {
assert(picture->i_refcount > 0); assert(picture->i_refcount > 0);
if (--picture->i_refcount > 0) if (--picture->i_refcount > 0)
return; return;
Unlock(picture);
}
static int Lock(picture_t *picture)
{
picture_release_sys_t *release_sys = picture->p_release_sys;
if (release_sys->lock)
return release_sys->lock(picture);
return VLC_SUCCESS;
}
static void Unlock(picture_t *picture)
{
picture_release_sys_t *release_sys = picture->p_release_sys; picture_release_sys_t *release_sys = picture->p_release_sys;
if (release_sys->unlock) if (release_sys->unlock)
release_sys->unlock(picture); release_sys->unlock(picture);
......
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