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.
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;
- vlc_mutex_unlock( &p_vout->p->snapshot.lock );
+ 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