mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
nettimeprovider: notify of changed bound address
Notify when the bound address is known, just like the port.
This commit is contained in:
parent
9ee7e72c36
commit
2541ddf123
1 changed files with 14 additions and 2 deletions
|
@ -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 ();
|
||||
|
|
Loading…
Reference in a new issue