[vlc-devel] [PATCH 1/5] picture_pool: change picture_pool_Cancel arguments
Thomas Guillem
thomas at gllm.fr
Fri Dec 11 13:34:44 CET 2015
Add a boolean to reset the cancel state to false.
---
include/vlc_picture_pool.h | 8 ++++----
src/misc/picture_pool.c | 7 ++++---
src/video_output/video_output.c | 2 +-
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/include/vlc_picture_pool.h b/include/vlc_picture_pool.h
index d967955..69a3d13 100644
--- a/include/vlc_picture_pool.h
+++ b/include/vlc_picture_pool.h
@@ -160,11 +160,11 @@ unsigned picture_pool_Reset( picture_pool_t * );
/**
* Cancel the picture pool.
*
- * It won't return any pictures via picture_pool_Get or picture_pool_Wait after
- * this call. This function will also unblock picture_pool_Wait. Call
- * picture_pool_Reset to reset the cancel state.
+ * It won't return any pictures via picture_pool_Get or picture_pool_Wait if
+ * canceled is true. This function will also unblock picture_pool_Wait.
+ * picture_pool_Reset will also reset the cancel state to false.
*/
-void picture_pool_Cancel( picture_pool_t * );
+void picture_pool_Cancel( picture_pool_t *, bool canceled );
/**
* Reserves pictures from a pool and creates a new pool with those.
diff --git a/src/misc/picture_pool.c b/src/misc/picture_pool.c
index b25ff94..8e72382 100644
--- a/src/misc/picture_pool.c
+++ b/src/misc/picture_pool.c
@@ -277,13 +277,14 @@ picture_t *picture_pool_Wait(picture_pool_t *pool)
return clone;
}
-void picture_pool_Cancel(picture_pool_t *pool)
+void picture_pool_Cancel(picture_pool_t *pool, bool canceled)
{
vlc_mutex_lock(&pool->lock);
assert(pool->refs > 0);
- pool->canceled = true;
- vlc_cond_broadcast(&pool->wait);
+ pool->canceled = canceled;
+ if (canceled)
+ vlc_cond_broadcast(&pool->wait);
vlc_mutex_unlock(&pool->lock);
}
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 5df9096..d8cb4cc 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1457,7 +1457,7 @@ static int ThreadReinit(vout_thread_t *vout,
static void ThreadCancel(vout_thread_t *vout)
{
- picture_pool_Cancel(vout->p->decoder_pool);
+ picture_pool_Cancel(vout->p->decoder_pool, true);
}
static int ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)
--
2.1.4
More information about the vlc-devel
mailing list