vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Wed Oct 29 16:46:02 2014 +0200| [657c1530b9180f3f5118835fb0c3d866162e3fa5] | committer: Rémi Denis-Courmont
vout: print error if the decoder leaked pictures > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=657c1530b9180f3f5118835fb0c3d866162e3fa5 --- include/vlc_picture_pool.h | 4 +++- src/misc/picture_pool.c | 7 +++++-- src/video_output/video_output.c | 8 ++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/vlc_picture_pool.h b/include/vlc_picture_pool.h index 4b520e1..7d37324 100644 --- a/include/vlc_picture_pool.h +++ b/include/vlc_picture_pool.h @@ -101,8 +101,10 @@ VLC_API picture_t * picture_pool_Get( picture_pool_t * ) VLC_USED; * @warning This can only be called when it is known that all pending * references to the picture pool are stale, e.g. a decoder failed to * release pictures properly when it terminated. + / + * @return the number of picture references that were freed */ -void picture_pool_Reset( picture_pool_t * ); +unsigned picture_pool_Reset( picture_pool_t * ); /** * It forces the next picture_pool_Get to return a picture even if no diff --git a/src/misc/picture_pool.c b/src/misc/picture_pool.c index 135b5d6..ce25461 100644 --- a/src/misc/picture_pool.c +++ b/src/misc/picture_pool.c @@ -274,8 +274,9 @@ picture_t *picture_pool_Get(picture_pool_t *pool) return NULL; } -void picture_pool_Reset(picture_pool_t *pool) +unsigned picture_pool_Reset(picture_pool_t *pool) { + unsigned ret = 0; retry: vlc_mutex_lock(&pool->lock); assert(pool->refs > 0); @@ -287,11 +288,13 @@ retry: if (sys->in_use) { vlc_mutex_unlock(&pool->lock); picture_Release(picture); - + ret++; goto retry; } } vlc_mutex_unlock(&pool->lock); + + return ret; } void picture_pool_NonEmpty(picture_pool_t *pool) diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index 66625b6..411b66f 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -1181,13 +1181,17 @@ static void ThreadReset(vout_thread_t *vout) { ThreadFlush(vout, true, INT64_MAX); if (vout->p->decoder_pool) { - unsigned count; + unsigned count, leaks; if (vout->p->private_pool != NULL) { count = picture_pool_GetSize(vout->p->private_pool); picture_pool_Delete(vout->p->private_pool); } - picture_pool_Reset(vout->p->decoder_pool); + + leaks = picture_pool_Reset(vout->p->decoder_pool); + if (leaks > 0) + msg_Err(vout, "%u picture(s) leaked by decoder", leaks); + if (vout->p->private_pool != NULL) { vout->p->private_pool = picture_pool_Reserve(vout->p->decoder_pool, count); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
