From: Wim Taymans Date: Thu, 11 Apr 2013 13:04:45 +0000 (+0100) Subject: nettimeprovider: notify of changed bound address X-Git-Tag: 1.1.1~137 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2541ddf123997b8a278be7a3563e2eef1fe2e864;p=platform%2Fupstream%2Fgstreamer.git nettimeprovider: notify of changed bound address Notify when the bound address is known, just like the port. --- diff --git a/libs/gst/net/gstnettimeprovider.c b/libs/gst/net/gstnettimeprovider.c index 5ad1b83..c4b4ef2 100644 --- a/libs/gst/net/gstnettimeprovider.c +++ b/libs/gst/net/gstnettimeprovider.c @@ -280,6 +280,7 @@ gst_net_time_provider_start (GstNetTimeProvider * self) GSocket *socket; GError *err = NULL; int port; + gchar *address; if (self->priv->address) { inet_addr = g_inet_address_new_from_string (self->priv->address); @@ -307,14 +308,25 @@ gst_net_time_provider_start (GstNetTimeProvider * self) bound_addr = g_socket_get_local_address (socket, NULL); port = g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS (bound_addr)); - GST_DEBUG_OBJECT (self, "bound on UDP port %d", port); - g_object_unref (bound_addr); - + inet_addr = + g_inet_socket_address_get_address (G_INET_SOCKET_ADDRESS (bound_addr)); + address = g_inet_address_to_string (inet_addr); + + if (g_strcmp0 (address, self->priv->address)) { + g_free (self->priv->address); + self->priv->address = address; + GST_DEBUG_OBJECT (self, "notifying address %s", address); + g_object_notify (G_OBJECT (self), "address"); + } else { + g_free (address); + } if (port != self->priv->port) { self->priv->port = port; GST_DEBUG_OBJECT (self, "notifying port %d", port); g_object_notify (G_OBJECT (self), "port"); } + GST_DEBUG_OBJECT (self, "bound on UDP address %s, port %d", address, port); + g_object_unref (bound_addr); self->priv->socket = socket; self->priv->cancel = g_cancellable_new ();