[vlc-commits] picture_pool: remove unnecessary special case

Rémi Denis-Courmont git at videolan.org
Wed Oct 29 20:27:50 CET 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Oct 27 21:05:00 2014 +0200| [1d2dcf803ab88fa85514d1f4843c6838cd6f408a] | committer: Rémi Denis-Courmont

picture_pool: remove unnecessary special case

We can offload the picture deletion to Destroy() in all cases.

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

 src/misc/picture_pool.c |   16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/misc/picture_pool.c b/src/misc/picture_pool.c
index 294d671..86b30ac 100644
--- a/src/misc/picture_pool.c
+++ b/src/misc/picture_pool.c
@@ -209,16 +209,12 @@ void picture_pool_Delete(picture_pool_t *pool)
 
             assert(!pool->picture_reserved[i]);
 
-            /* Restore the original garbage collector */
-            if (atomic_fetch_add(&picture->gc.refcount, 1) == 0)
-            {   /* Simple case: the picture is not locked, destroy it now. */
-                picture->gc.pf_destroy = gc_sys->destroy;
-                picture->gc.p_sys      = gc_sys->destroy_sys;
-                free(gc_sys);
-            }
-            else /* Intricate case: the picture is still locked and the gc
-                    cannot be modified (w/o memory synchronization). */
-                atomic_store(&gc_sys->zombie, true);
+            /* Restore the initial reference that was cloberred in
+             * picture_pool_NewExtended(). */
+            atomic_fetch_add(&picture->gc.refcount, 1);
+            /* The picture might still locked and then the G.C. state cannot be
+             * modified (w/o memory synchronization). */
+            atomic_store(&gc_sys->zombie, true);
 
             picture_Release(picture);
         }



More information about the vlc-commits mailing list