Commit 8610a92b authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Almost wait-free snapshot handling in the vout thread

Using vlc_mutex_trylock(), we make sure that the video output thread
will not yield because of an incomplete snapshot request. It can still
yield in the very unlikely case that a thread is doing a snapshot
request while the video output thread finishes sorting SPUs _and_ there
already was a pending snapshot earlier.
parent 685ac18a
......@@ -1191,11 +1191,13 @@ static void* RunThread( void *p_this )
p_filtered_picture = filter_chain_VideoFilter( p_vout->p->p_vf2_chain,
p_picture );
/* FIXME it is ugly that b_snapshot is not locked but I do not
* know which lock to use (here and in the snapshot callback) */
vlc_mutex_lock( &p_vout->p->snapshot.lock );
const bool b_snapshot = p_vout->p->snapshot.i_request > 0 && p_picture != NULL;
bool b_snapshot = false;
if( vlc_mutex_trylock( &p_vout->p->snapshot.lock ) == 0 )
{
b_snapshot = p_vout->p->snapshot.i_request > 0
&& p_picture != NULL;
vlc_mutex_unlock( &p_vout->p->snapshot.lock );
}
/*
* Check for subpictures to display
......
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