Commit 657c1530 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vout: print error if the decoder leaked pictures

parent 89006bba
......@@ -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
......
......@@ -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)
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment