<html><head></head><body>Well it wouldn't surprise me if it created races or inversions. but it would surprise me if doing it one way would avoid races and the other way not.<br><br><div class="gmail_quote">Le 4 juillet 2018 11:37:57 GMT+03:00, Thomas Guillem <thomas@gllm.fr> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail"><br>On Tue, Jul 3, 2018, at 17:58, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> Le tiistaina 3. heinäkuuta 2018, 14.22.30 EEST Thomas Guillem a écrit :<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> On Tue, Jul 3, 2018, at 13:20, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;"> There should not be a need to move the current state out of the<br> stack, AFAIU.><br> <br>  I like to keep thread variables on stack because it's then obvious<br>  what the access rule is (read/write for the thread) and if the<br>  variable becomes unused.<br></blockquote> <br> Then, how do you fix what this commit is trying to fix ? With a reset<br> bool that reset pause/rate from the DecoderThread stack ?<br></blockquote> <br> Set the correct values when you get the xout ?<br></blockquote><br>I implemented it (badly), pushed it, and force reverted it.<br>It's more difficult than expected. With the 2 different locks and thread, it's hard (impossible?) to never miss a rate/paused state.<br><br>I explain, cf. aout diff (the same for vout):<br><br>@@ -384,6 +384,17 @@ static int aout_update_format( decoder_t *p_dec )<br>             }<br>         }<br><br>+        vlc_fifo_Lock( p_owner->p_fifo );<br>+        float rate = p_owner->rate;<br>+        vlc_tick_t pause_date = p_owner->pause_date;<br>+        bool paused = p_owner->paused;<br>+        vlc_fifo_Unlock( p_owner->p_fifo );<br>+<br>+        if( paused )<br>+            aout_DecChangePause( p_aout, paused, pause_date );<br>+        if( rate != 1.f )<br>+            aout_DecChangeRate( p_aout, rate );<br>+<br>         vlc_mutex_lock( &p_owner->lock );<br>         p_owner->p_aout = p_aout;<br><br>Here I update the aout state before writing it to p_owner->p_aout so that the DecoderThread won't change these states on its own. But if a new pause/rate is sent from the input between vlc_fifo_Unlock( p_owner->p_fifo ) and vlc_mutex_lock( &p_owner->lock ), and if the DecoderThread already process it in the meantime (and ignore it since since there is no aout), the state will be missed.<br><br><br>Therefore, I prefer doing what this V3 patch set is doing.<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> <br> -- <br> Реми Дёни-Курмон<br> <a href="http://www.remlab.net/">http://www.remlab.net/</a><br> <br> <br> <br><hr><br> vlc-devel mailing list<br> To unsubscribe or modify your subscription options:<br> <a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote><hr><br>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>
-- <br>
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>