Commit 0902f0d6 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

decoder: reduce lock scope and cosmetic

p_owner->b_paused can only be written by the owner, so the owner thread
does not need to lock to read it. (However, locking is necessary to
write it from the owner thread, or to read it from the decoder thread.)
parent a308b7a1
...@@ -2056,11 +2056,13 @@ void input_DecoderChangePause( decoder_t *p_dec, bool b_paused, mtime_t i_date ) ...@@ -2056,11 +2056,13 @@ void input_DecoderChangePause( decoder_t *p_dec, bool b_paused, mtime_t i_date )
{ {
decoder_owner_sys_t *p_owner = p_dec->p_owner; decoder_owner_sys_t *p_owner = p_dec->p_owner;
vlc_mutex_lock( &p_owner->lock );
/* Normally, p_owner->b_paused != b_paused here. But if a track is added /* Normally, p_owner->b_paused != b_paused here. But if a track is added
* while the input is paused (e.g. add sub file), then b_paused is * while the input is paused (e.g. add sub file), then b_paused is
* (incorrectly) false. */ * (incorrectly) false. FIXME: This is a bug in the decoder owner. */
if( likely(p_owner->b_paused != b_paused) ) { if( unlikely(p_owner->b_paused == b_paused) )
return;
vlc_mutex_lock( &p_owner->lock );
p_owner->b_paused = b_paused; p_owner->b_paused = b_paused;
p_owner->pause.i_date = i_date; p_owner->pause.i_date = i_date;
p_owner->pause.i_ignore = 0; p_owner->pause.i_ignore = 0;
...@@ -2080,7 +2082,6 @@ void input_DecoderChangePause( decoder_t *p_dec, bool b_paused, mtime_t i_date ) ...@@ -2080,7 +2082,6 @@ void input_DecoderChangePause( decoder_t *p_dec, bool b_paused, mtime_t i_date )
if( p_owner->p_vout ) if( p_owner->p_vout )
vout_ChangePause( p_owner->p_vout, b_paused, i_date ); vout_ChangePause( p_owner->p_vout, b_paused, i_date );
} }
}
vlc_mutex_unlock( &p_owner->lock ); vlc_mutex_unlock( &p_owner->lock );
} }
......
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