Commit 98f3a7b3 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vout: remove unnecessary lock around the picture FIFO

The picture FIFO has a lock internally to protect its internal state
while picture references protect the pictures.

There is no need to protect the FIFO usage with the picture lock.
At this point, the picture lock is only protected the decoder pool.
parent 72f131d9
...@@ -330,43 +330,36 @@ void vout_Reset(vout_thread_t *vout) ...@@ -330,43 +330,36 @@ void vout_Reset(vout_thread_t *vout)
bool vout_IsEmpty(vout_thread_t *vout) bool vout_IsEmpty(vout_thread_t *vout)
{ {
vlc_mutex_lock(&vout->p->picture_lock);
picture_t *picture = picture_fifo_Peek(vout->p->decoder_fifo); picture_t *picture = picture_fifo_Peek(vout->p->decoder_fifo);
if (picture) if (picture)
picture_Release(picture); picture_Release(picture);
vlc_mutex_unlock(&vout->p->picture_lock);
return !picture; return !picture;
} }
void vout_FixLeaks( vout_thread_t *vout ) void vout_FixLeaks( vout_thread_t *vout )
{ {
vlc_mutex_lock(&vout->p->picture_lock);
picture_t *picture = picture_fifo_Peek(vout->p->decoder_fifo); picture_t *picture = picture_fifo_Peek(vout->p->decoder_fifo);
if (!picture) { if (picture != NULL) {
picture = picture_pool_Get(vout->p->decoder_pool);
}
if (picture) {
picture_Release(picture); picture_Release(picture);
/* Not all pictures has been displayed yet or some are return; /* Not all pictures has been displayed yet */
* free */
vlc_mutex_unlock(&vout->p->picture_lock);
return;
}
/* There is no reason that no pictures are available, force one
* from the pool, becarefull with it though */
msg_Err(vout, "pictures leaked, trying to workaround");
/* */ }
picture_pool_NonEmpty(vout->p->decoder_pool);
vlc_mutex_lock(&vout->p->picture_lock);
picture = picture_pool_Get(vout->p->decoder_pool);
if (picture != NULL)
picture_Release(picture); /* Not all pictures are referenced */
else {
/* There are no reasons that no pictures are available, force one
* from the pool, be careful with it though */
msg_Err(vout, "pictures leaked, trying to workaround");
picture_pool_NonEmpty(vout->p->decoder_pool);
}
vlc_mutex_unlock(&vout->p->picture_lock); vlc_mutex_unlock(&vout->p->picture_lock);
} }
void vout_NextPicture(vout_thread_t *vout, mtime_t *duration) void vout_NextPicture(vout_thread_t *vout, mtime_t *duration)
{ {
vout_control_cmd_t cmd; vout_control_cmd_t cmd;
...@@ -441,13 +434,9 @@ picture_t *vout_GetPicture(vout_thread_t *vout) ...@@ -441,13 +434,9 @@ picture_t *vout_GetPicture(vout_thread_t *vout)
*/ */
void vout_PutPicture(vout_thread_t *vout, picture_t *picture) void vout_PutPicture(vout_thread_t *vout, picture_t *picture)
{ {
vlc_mutex_lock(&vout->p->picture_lock);
picture->p_next = NULL; picture->p_next = NULL;
picture_fifo_Push(vout->p->decoder_fifo, picture); picture_fifo_Push(vout->p->decoder_fifo, picture);
vlc_mutex_unlock(&vout->p->picture_lock);
vout_control_Wake(&vout->p->control); vout_control_Wake(&vout->p->control);
} }
......
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