[vlc-devel] [PATCH 5/5] picture_pool: do not fail if pictures are available immediately

Rémi Denis-Courmont remi at remlab.net
Mon Nov 30 18:02:09 CET 2015


This avoids spurious errors in the decoders (and logs).
---
 src/misc/picture_pool.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/misc/picture_pool.c b/src/misc/picture_pool.c
index ececf19..364dfdc 100644
--- a/src/misc/picture_pool.c
+++ b/src/misc/picture_pool.c
@@ -244,13 +244,14 @@ picture_t *picture_pool_Wait(picture_pool_t *pool)
     vlc_mutex_lock(&pool->lock);
     assert(pool->refs > 0);
 
-    while (pool->available == 0 && !pool->canceled)
-        vlc_cond_wait(&pool->wait, &pool->lock);
-
-    if (pool->canceled)
+    while (pool->available == 0)
     {
-        vlc_mutex_unlock(&pool->lock);
-        return NULL;
+        if (pool->canceled)
+        {
+            vlc_mutex_unlock(&pool->lock);
+            return NULL;
+        }
+        vlc_cond_wait(&pool->wait, &pool->lock);
     }
 
     i = ffsll(pool->available);
-- 
2.6.2



More information about the vlc-devel mailing list