[vlc-commits] picture_pool: handle reserve pool pictures

Rémi Denis-Courmont git at videolan.org
Thu Dec 27 22:30:42 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Dec 27 23:28:25 2018 +0200| [c3aa6dca8ff0fe368b2de5d775b20c0d678680c0] | committer: Rémi Denis-Courmont

picture_pool: handle reserve pool pictures

This adds yet another kludge to detect if a picture is from a pool
through another (reserve) pool. This avoids copying pictures allocated
by filters through the "private pool", until displays are fixed not to
rely on pools.

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

 src/misc/picture_pool.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/misc/picture_pool.c b/src/misc/picture_pool.c
index e0fbdd7333..7015f07fa0 100644
--- a/src/misc/picture_pool.c
+++ b/src/misc/picture_pool.c
@@ -299,9 +299,18 @@ bool picture_pool_OwnsPic(picture_pool_t *pool, picture_t *pic)
         priv = (picture_priv_t *)pic;
     }
 
-    uintptr_t sys = (uintptr_t)priv->gc.opaque;
-    picture_pool_t *picpool = (void *)(sys & ~(POOL_MAX - 1));
-    return pool == picpool;
+    do {
+        uintptr_t sys = (uintptr_t)priv->gc.opaque;
+        picture_pool_t *picpool = (void *)(sys & ~(POOL_MAX - 1));
+
+        if (pool == picpool)
+            return true;
+
+        pic = picpool->picture[sys & (POOL_MAX - 1 )];
+        priv = (picture_priv_t *)pic;
+    } while (priv->gc.destroy == picture_pool_ReleasePicture);
+
+    return false;
 }
 
 unsigned picture_pool_GetSize(const picture_pool_t *pool)



More information about the vlc-commits mailing list