multiudpsink: fix client count after removal
authorTim-Philipp Müller <tim@centricular.com>
Mon, 23 Jun 2014 23:56:27 +0000 (00:56 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Tue, 16 Dec 2014 20:26:36 +0000 (20:26 +0000)
gst/udp/gstmultiudpsink.c

index c456a99..52099cd 100644 (file)
@@ -1734,6 +1734,7 @@ gst_multiudpsink_add (GstMultiUDPSink * sink, const gchar * host, gint port)
 void
 gst_multiudpsink_remove (GstMultiUDPSink * sink, const gchar * host, gint port)
 {
+  GSocketFamily family;
   GList *find;
   GstUDPClient udpclient;
   GstUDPClient *client;
@@ -1755,9 +1756,14 @@ gst_multiudpsink_remove (GstMultiUDPSink * sink, const gchar * host, gint port)
 
   --client->add_count;
 
+  family = g_socket_address_get_family (client->addr);
+  if (family == G_SOCKET_FAMILY_IPV4)
+    --sink->num_v4_all;
+  else
+    --sink->num_v6_all;
+
   if (client->add_count == 0) {
     GInetSocketAddress *saddr = G_INET_SOCKET_ADDRESS (client->addr);
-    GSocketFamily family = g_socket_address_get_family (client->addr);
     GInetAddress *addr = g_inet_socket_address_get_address (saddr);
     GSocket *socket;
 
@@ -1784,6 +1790,11 @@ gst_multiudpsink_remove (GstMultiUDPSink * sink, const gchar * host, gint port)
       }
     }
 
+    if (family == G_SOCKET_FAMILY_IPV4)
+      --sink->num_v4_unique;
+    else
+      --sink->num_v6_unique;
+
     /* Unlock to emit signal before we delete the actual client */
     g_mutex_unlock (&sink->client_lock);
     g_signal_emit (G_OBJECT (sink),