<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div><br></div><div>On Tue, Sep 3, 2019, at 14:34, Rémi Denis-Courmont wrote:<br></div><blockquote type="cite" id="qt"><div>Hi,<br></div><div><br></div><div>AFAIK, it is, or at least was at some point, safe to read outside the lock because no other thread could write it.<br></div></blockquote><div><br></div><div>If it safe to read outside the lock from the output thread (vout/aout callbacks). Cf my patch documentation.<br></div><div><br></div><blockquote type="cite" id="qt"><div><br></div><div>It's silly to maximize lock scope. Lock scope should be minimised.<br></div><div><br></div><div class="qt-gmail_quote"><div>Le 3 septembre 2019 11:29:28 GMT+03:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<br></div><blockquote style="margin-top:0pt;margin-right:0pt;margin-bottom:0pt;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><pre class="qt-k9mail"><div>It's already done this way for p_vout. Since we're going to lock for writing,<br></div><div>we might as well read the value in that lock.<hr> src/input/decoder.c | 5 ++---<br></div><div> 1 file changed, 2 insertions(+), 3 deletions(-)<br></div><div><br></div><div>diff --git a/src/input/decoder.c b/src/input/decoder.c<br></div><div>index 63f858c397..25aa1e0727 100644<br></div><div>--- a/src/input/decoder.c<br></div><div>+++ b/src/input/decoder.c<br></div><div>@@ -220,9 +220,9 @@ static int ReloadDecoder( struct decoder_owner *p_owner, bool b_packetizer,<br></div><div> if( reload == RELOAD_DECODER_AOUT )<br></div><div> {<br></div><div> assert( p_owner->fmt.i_cat == AUDIO_ES );<br></div><div>- audio_output_t *p_aout = p_owner->p_aout;<br></div><div> <br></div><div> vlc_mutex_lock( &p_owner->lock );<br></div><div>+ audio_output_t *p_aout = p_owner->p_aout;<br></div><div> p_owner->p_aout = NULL;<br></div><div> vlc_mutex_unlock( &p_owner->lock );<br></div><div> if( p_aout )<br></div><div>@@ -301,10 +301,9 @@ static int aout_update_format( decoder_t *p_dec )<br></div><div> p_dec->fmt_out.i_codec != p_dec->fmt_out.audio.i_format ||<br></div><div> p_dec->fmt_out.i_profile != p_owner->fmt.i_profile ) )<br></div><div> {<br></div><div>- audio_output_t *p_aout = p_owner->p_aout;<br></div><div>-<br></div><div> /* Parameters changed, restart the aout */<br></div><div> vlc_mutex_lock( &p_owner->lock );<br></div><div>+ audio_output_t *p_aout = p_owner->p_aout;<br></div><div> p_owner->p_aout = NULL;<br></div><div> vlc_mutex_unlock( &p_owner->lock );<br></div><div> aout_DecDelete( p_aout );<br></div></pre></blockquote></div><div><br></div><div>-- <br></div><div>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté. <br></div><div>_______________________________________________<br></div><div>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div>https://mailman.videolan.org/listinfo/vlc-devel<br></div></blockquote><div><br></div></body></html>