<html><head></head><body>Hi,<br><br>As a general rule, a module is responsible for completing any pending work before it returns from its deactivate function'<br><br>The actual unmapping of plugins happens only when LibVLC terminates.<br><br><div class="gmail_quote">Le 20 février 2019 11:08:54 GMT+02:00, Steve Lhomme <robux4@ycbcr.xyz> 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">On 19/02/2019 13:24, Thomas Guillem wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> The module need to be unloaded before the dec struct is cleaned.<br><br> This fixes an undefined behavior with threaded decoders like avcodec when they<br> called decoder_UpdateVideoFormat()/dec_NewPicture() from an other thread just<br> before they were unloaded.<br></blockquote><br>Are there cases where the decoder is still calling <br>decoder_UpdateVideoFormat() and decoder_NewPicture() while being about <br>to be unloaded ? I don't see how this can work if one thread of the <br>decoder is calling decoder_UpdateVideoFormat() while another thread is <br>unloading the decoder DLLs. If that can happen I think the undefined <br>behavior is the least of our problem.<br><br>AFAIK lavc always call decoder_UpdateVideoFormat()/decoder_NewPicture() <br>from the same (decoder?) thread.<br><br>This is an important thing because the decoder pool will be released <br>there as well as the video context reference count.<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><hr>   src/input/decoder_helpers.c | 11 ++++++-----<br>   1 file changed, 6 insertions(+), 5 deletions(-)<br><br> diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c<br> index 3cc02de8d6..b0a7c1890a 100644<br> --- a/src/input/decoder_helpers.c<br> +++ b/src/input/decoder_helpers.c<br> @@ -48,6 +48,12 @@ void decoder_Init( decoder_t *p_dec, const es_format_t *restrict p_fmt )<br>   <br>   void decoder_Clean( decoder_t *p_dec )<br>   {<br> +    if ( p_dec->p_module != NULL )<br> +    {<br> +        module_unneed(p_dec, p_dec->p_module);<br> +        p_dec->p_module = NULL;<br> +    }<br> +<br>       es_format_Clean( &p_dec->fmt_in );<br>       es_format_Clean( &p_dec->fmt_out );<br>   <br> @@ -56,11 +62,6 @@ void decoder_Clean( decoder_t *p_dec )<br>           vlc_meta_Delete(p_dec->p_description);<br>           p_dec->p_description = NULL;<br>       }<br> -    if ( p_dec->p_module != NULL )<br> -    {<br> -        module_unneed(p_dec, p_dec->p_module);<br> -        p_dec->p_module = NULL;<br> -    }<br>   }<br>   <br>   void decoder_Destroy( decoder_t *p_dec )<br> -- <br> 2.20.1<hr> 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>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>