<html><head></head><body>Hi,<br><br>No, it's one thread per address/socket, handling one or more sessions.<br><br><div class="gmail_quote">Le 10 février 2020 09:46: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 2020-02-10 8:22, 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;">Hi,<br><br>Before it would wait to be cancelled when there are no sessions. Now it <br>exits on its own.<br></blockquote><br>Ah, I just realized that it's one thread per session. I thought it was <br>one for all.<br><br>So if you register, unregister, register the same session it was already <br>closing the first thread and create a new one.<br><br><br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">Le 10 février 2020 08:54:21 GMT+02:00, Steve Lhomme <robux4@ycbcr.xyz> a <br>écrit :<br><br> On 2020-02-09 14:33, Rémi Denis-Courmont wrote:<hr> src/stream_output/sap.c | 22 ++++++++--------------<br> 1 file changed, 8 insertions(+), 14 deletions(-)<br><br> diff --git a/src/stream_output/sap.c b/src/stream_output/sap.c<br> index eb85ab7297..481f3e5f20 100644<br> --- a/src/stream_output/sap.c<br> +++ b/src/stream_output/sap.c<br> @@ -27,7 +27,6 @@<br><br> #include <vlc_common.h><br><br> -#include <stdnoreturn.h><br> #include <stdlib.h> /* free() */<br> #include <stdio.h> /* sprintf() */<br> #include <string.h><br> @@ -81,7 +80,7 @@ static vlc_mutex_t sap_mutex = VLC_STATIC_MUTEX;<br> #define MIN_INTERVAL 2<br> #define MAX_INTERVAL 300<br><br> -noreturn static void *RunThread (void *);<br> +static void *RunThread (void *);<br><br> static sap_address_t *AddressCreate (vlc_object_t *obj, const<br> char *group)<br> {<br> @@ -120,14 +119,13 @@ static void AddressDestroy (sap_address_t<br> *addr)<br> * \param p_this the SAP Handler object<br> * \return nothing<br> */<br> -noreturn static void *RunThread (void *self)<br> +static void *RunThread (void *self)<br> {<br> sap_address_t *addr = self;<br><br> vlc_mutex_lock(&sap_mutex);<br> - mutex_cleanup_push(&sap_mutex);<br><br> - for (;;)<br> + while (!vlc_list_is_empty(&addr->sessions))<br><br><br> So when the number of sessions goes down to zero, it exits. Before it<br> would wait, in case a new session would come. Is this intended ?<br><br> {<br> session_descriptor_t *p_session;<br> vlc_tick_t deadline = vlc_tick_now();<br> @@ -144,8 +142,8 @@ noreturn static void *RunThread (void *self)<br> }<br> }<br><br> - vlc_cleanup_pop ();<br> - vlc_assert_unreachable ();<br> + vlc_mutex_unlock(&sap_mutex);<br> + return NULL;<br> }<br><br> #undef sout_AnnounceRegisterSDP<br> @@ -372,17 +370,13 @@ void sout_AnnounceUnRegister (vlc_object_t<br> *obj, session_descriptor_t *session)<br> if (vlc_list_is_empty(&addr->sessions))<br> /* Last session for this address -> unlink the address */<br> vlc_list_remove(&addr->node);<br> - else<br> - {<br> - addr->session_count--;<br> - vlc_cond_signal (&addr->wait);<br> - }<br><br> - vlc_mutex_unlock (&sap_mutex);<br> + addr->session_count--;<br> + vlc_cond_signal(&addr->wait);<br> + vlc_mutex_unlock(&sap_mutex);<br><br> if (vlc_list_is_empty(&addr->sessions))<br> {<br> - vlc_cancel(addr->thread);<br> vlc_join(addr->thread, NULL);<br> AddressDestroy(addr);<br> }<br> -- <br> 2.25.0<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><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><br><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser <br>ma brièveté.<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><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>