[vlc-devel] [PATCH 1/3] picture_pool: remove always NULL picture lock callback

Steve Lhomme robux4 at ycbcr.xyz
Wed Jan 22 12:07:22 CET 2020


---
 include/vlc_picture_pool.h | 10 +---------
 src/misc/picture_pool.c    | 20 --------------------
 2 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/include/vlc_picture_pool.h b/include/vlc_picture_pool.h
index 1915032009f..c523e7630d4 100644
--- a/include/vlc_picture_pool.h
+++ b/include/vlc_picture_pool.h
@@ -41,8 +41,6 @@ typedef struct picture_pool_t picture_pool_t;
 typedef struct {
     unsigned  picture_count;
     picture_t *const *picture;
-
-    int       (*lock)(picture_t *);
 } picture_pool_configuration_t;
 
 /**
@@ -56,11 +54,6 @@ typedef struct {
  * decrease the reference count, use picture_Hold() and picture_Release()
  * respectively.
  *
- * If defined, picture_pool_configuration_t::lock will be called before
- * a picture is used, and picture_pool_configuration_t::unlock will be called
- * as soon as a picture is returned to the pool.
- * Those callbacks can modify picture_t::p and access picture_t::p_sys.
- *
  * @return A pointer to the new pool on success, or NULL on error
  * (pictures are <b>not</b> released on error).
  */
@@ -68,8 +61,7 @@ VLC_API picture_pool_t * picture_pool_NewExtended( const picture_pool_configurat
 
 /**
  * Creates a picture pool with pictures in a given array.
- * This is a convenience wrapper for picture_pool_NewExtended() without the
- * lock and unlock callbacks.
+ * This is a convenience wrapper for picture_pool_NewExtended().
  *
  * @param count number of pictures in the array
  * @param tab array of pictures
diff --git a/src/misc/picture_pool.c b/src/misc/picture_pool.c
index d4d2418d636..25c161b8b60 100644
--- a/src/misc/picture_pool.c
+++ b/src/misc/picture_pool.c
@@ -39,7 +39,6 @@
 static_assert ((POOL_MAX & (POOL_MAX - 1)) == 0, "Not a power of two");
 
 struct picture_pool_t {
-    int       (*pic_lock)(picture_t *);
     vlc_mutex_t lock;
     vlc_cond_t  wait;
 
@@ -110,7 +109,6 @@ picture_pool_t *picture_pool_NewExtended(const picture_pool_configuration_t *cfg
     if (unlikely(pool == NULL))
         return NULL;
 
-    pool->pic_lock   = cfg->lock;
     vlc_mutex_init(&pool->lock);
     vlc_cond_init(&pool->wait);
     if (cfg->picture_count == POOL_MAX)
@@ -201,14 +199,6 @@ picture_t *picture_pool_Get(picture_pool_t *pool)
         vlc_mutex_unlock(&pool->lock);
         available &= ~(1ULL << i);
 
-        picture_t *picture = pool->picture[i];
-
-        if (pool->pic_lock != NULL && pool->pic_lock(picture) != VLC_SUCCESS) {
-            vlc_mutex_lock(&pool->lock);
-            pool->available |= 1ULL << i;
-            continue;
-        }
-
         picture_t *clone = picture_pool_ClonePicture(pool, i);
         if (clone != NULL) {
             assert(clone->p_next == NULL);
@@ -240,16 +230,6 @@ picture_t *picture_pool_Wait(picture_pool_t *pool)
     pool->available &= ~(1ULL << i);
     vlc_mutex_unlock(&pool->lock);
 
-    picture_t *picture = pool->picture[i];
-
-    if (pool->pic_lock != NULL && pool->pic_lock(picture) != VLC_SUCCESS) {
-        vlc_mutex_lock(&pool->lock);
-        pool->available |= 1ULL << i;
-        vlc_cond_signal(&pool->wait);
-        vlc_mutex_unlock(&pool->lock);
-        return NULL;
-    }
-
     picture_t *clone = picture_pool_ClonePicture(pool, i);
     if (clone != NULL) {
         assert(clone->p_next == NULL);
-- 
2.17.1



More information about the vlc-devel mailing list