Commit 1172b7c3 authored by Thomas Guillem's avatar Thomas Guillem

vout: drop pictures owned by old vouts

See FIXME comment.
parent 92e12667
......@@ -154,6 +154,13 @@ VLC_API void picture_pool_Enum( picture_pool_t *,
*/
void picture_pool_Cancel( picture_pool_t *, bool canceled );
/**
* Test if a picture belongs to the picture pool
*
* FIXME: remove this function when the vout_PutPicture() hack is fixed.
*/
bool picture_pool_OwnsPic( picture_pool_t *, picture_t *);
/**
* Reserves pictures from a pool and creates a new pool with those.
*
......
......@@ -296,6 +296,14 @@ void picture_pool_Cancel(picture_pool_t *pool, bool canceled)
vlc_mutex_unlock(&pool->lock);
}
bool picture_pool_OwnsPic(picture_pool_t *pool, picture_t *pic)
{
picture_priv_t *priv = (picture_priv_t *)pic;
uintptr_t sys = (uintptr_t)priv->gc.opaque;
picture_pool_t *picpool = (void *)(sys & ~(POOL_MAX - 1));
return pool == picpool;
}
unsigned picture_pool_GetSize(const picture_pool_t *pool)
{
return pool->picture_count;
......
......@@ -425,9 +425,19 @@ picture_t *vout_GetPicture(vout_thread_t *vout)
void vout_PutPicture(vout_thread_t *vout, picture_t *picture)
{
picture->p_next = NULL;
picture_fifo_Push(vout->p->decoder_fifo, picture);
if (picture_pool_OwnsPic(vout->p->decoder_pool, picture))
{
picture_fifo_Push(vout->p->decoder_fifo, picture);
vout_control_Wake(&vout->p->control);
vout_control_Wake(&vout->p->control);
}
else
{
/* FIXME: HACK: Drop this picture because the vout changed. The old
* picture pool need to be kept by the new vout. This requires a major
* "vout display" API change. */
picture_Release(picture);
}
}
/* */
......
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