<html><head></head><body>Right, will fix locally.<br><br><div class="gmail_quote">Le 10 février 2020 08:54:55 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">I think you forgot to remove the lock field in struct sap_address_t.<br><br>On 2020-02-09 14:33, 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;">This is simpler and even necessary for the following fix.<hr>  src/stream_output/sap.c | 32 +++++++++++---------------------<br>  1 file changed, 11 insertions(+), 21 deletions(-)<br><br>diff --git a/src/stream_output/sap.c b/src/stream_output/sap.c<br>index 8c5413fb17..ca5a2f22c6 100644<br>--- a/src/stream_output/sap.c<br>+++ b/src/stream_output/sap.c<br>@@ -102,7 +102,6 @@ static sap_address_t *AddressCreate (vlc_object_t *obj, const char *group)<br>      getsockname (fd, (struct sockaddr *)&addr->orig, &addr->origlen);<br>  <br>      addr->interval = var_CreateGetInteger (obj, "sap-interval");<br>-    vlc_mutex_init (&addr->lock);<br>      vlc_cond_init (&addr->wait);<br>      addr->session_count = 0;<br>      vlc_list_init(&addr->sessions);<br>@@ -124,7 +123,6 @@ static void AddressDestroy (sap_address_t *addr)<br>      vlc_cancel (addr->thread);<br>      vlc_join (addr->thread, NULL);<br>      vlc_cond_destroy (&addr->wait);<br>-    vlc_mutex_destroy (&addr->lock);<br>      net_Close (addr->fd);<br>      free (addr);<br>  }<br>@@ -138,8 +136,8 @@ noreturn static void *RunThread (void *self)<br>  {<br>      sap_address_t *addr = self;<br>  <br>-    vlc_mutex_lock (&addr->lock);<br>-    mutex_cleanup_push (&addr->lock);<br>+    vlc_mutex_lock(&sap_mutex);<br>+    mutex_cleanup_push(&sap_mutex);<br>  <br>      for (;;)<br>      {<br>@@ -147,7 +145,7 @@ noreturn static void *RunThread (void *self)<br>          vlc_tick_t deadline;<br>  <br>          while (vlc_list_is_empty(&addr->sessions))<br>-            vlc_cond_wait (&addr->wait, &addr->lock);<br>+            vlc_cond_wait(&addr->wait, &sap_mutex);<br>  <br>          assert (addr->session_count > 0);<br>  <br>@@ -157,7 +155,7 @@ noreturn static void *RunThread (void *self)<br>              send (addr->fd, p_session->data, p_session->length, 0);<br>              deadline += vlc_tick_from_samples(addr->interval, addr->session_count);<br>  <br>-            if (vlc_cond_timedwait (&addr->wait, &addr->lock, deadline) == 0)<br>+            if (vlc_cond_timedwait(&addr->wait, &sap_mutex, deadline) == 0)<br>                  break; /* list may have changed! */<br>          }<br>      }<br>@@ -293,10 +291,6 @@ sout_AnnounceRegisterSDP (vlc_object_t *obj, const char *sdp,<br>      }<br>  matched:<br>      vlc_list_append(&sap_addr->node, &sap_addrs);<br>-    /* Switch locks.<br>-     * NEVER take the global SAP lock when holding a SAP thread lock! */<br>-    vlc_mutex_lock (&sap_addr->lock);<br>-    vlc_mutex_unlock (&sap_mutex);<br>  <br>      session_descriptor_t *session = malloc(sizeof (*session));<br>      if (unlikely(session == NULL))<br>@@ -358,7 +352,7 @@ matched:<br>      sap_addr->session_count++;<br>      vlc_cond_signal (&sap_addr->wait);<br>  out:<br>-    vlc_mutex_unlock (&sap_addr->lock);<br>+    vlc_mutex_unlock(&sap_mutex);<br>      return session;<br>  }<br>  <br>@@ -375,27 +369,23 @@ void sout_AnnounceUnRegister (vlc_object_t *obj, session_descriptor_t *session)<br>  <br>      msg_Dbg (obj, "removing SAP session");<br>      vlc_mutex_lock (&sap_mutex);<br>-    vlc_mutex_lock(&addr->lock);<br>      vlc_list_remove(&session->node);<br>  <br>      if (vlc_list_is_empty(&addr->sessions))<br>          /* Last session for this address -> unlink the address */<br>          vlc_list_remove(&addr->node);<br>-    vlc_mutex_unlock (&sap_mutex);<br>-<br>-    if (vlc_list_is_empty(&addr->sessions))<br>-    {<br>-        /* Last session for this address -> unlink the address */<br>-        vlc_mutex_unlock (&addr->lock);<br>-        AddressDestroy (addr);<br>-    }<br>      else<br>      {<br>          addr->session_count--;<br>          vlc_cond_signal (&addr->wait);<br>-        vlc_mutex_unlock (&addr->lock);<br>      }<br>  <br>+    vlc_mutex_unlock (&sap_mutex);<br>+<br>+    if (vlc_list_is_empty(&addr->sessions))<br>+        /* Last session for this address -> unlink the address */<br>+        AddressDestroy (addr);<br>+<br>      free(session->data);<br>      free(session);<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><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>