mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-01 21:18:52 +00:00
netclock: Add support for IPv6
This commit is contained in:
parent
1905219235
commit
d420686764
2 changed files with 19 additions and 18 deletions
|
@ -350,18 +350,34 @@ gst_net_client_clock_start (GstNetClientClock * self)
|
|||
GInetAddress *inetaddr;
|
||||
GSocket *socket;
|
||||
GError *error = NULL;
|
||||
GSocketFamily family;
|
||||
|
||||
g_return_val_if_fail (self->priv->address != NULL, FALSE);
|
||||
g_return_val_if_fail (self->priv->servaddr == NULL, FALSE);
|
||||
|
||||
socket = g_socket_new (G_SOCKET_FAMILY_IPV4, G_SOCKET_TYPE_DATAGRAM,
|
||||
/* create target address */
|
||||
inetaddr = g_inet_address_new_from_string (self->priv->address);
|
||||
if (inetaddr == NULL)
|
||||
goto bad_address;
|
||||
|
||||
family = g_inet_address_get_family (inetaddr);
|
||||
|
||||
servaddr = g_inet_socket_address_new (inetaddr, self->priv->port);
|
||||
g_object_unref (inetaddr);
|
||||
|
||||
g_assert (servaddr != NULL);
|
||||
|
||||
GST_DEBUG_OBJECT (self, "will communicate with %s:%d", self->priv->address,
|
||||
self->priv->port);
|
||||
|
||||
socket = g_socket_new (family, G_SOCKET_TYPE_DATAGRAM,
|
||||
G_SOCKET_PROTOCOL_UDP, &error);
|
||||
|
||||
if (socket == NULL)
|
||||
goto no_socket;
|
||||
|
||||
GST_DEBUG_OBJECT (self, "binding socket");
|
||||
inetaddr = g_inet_address_new_any (G_SOCKET_FAMILY_IPV4);
|
||||
inetaddr = g_inet_address_new_any (family);
|
||||
anyaddr = g_inet_socket_address_new (inetaddr, 0);
|
||||
g_socket_bind (socket, anyaddr, TRUE, &error);
|
||||
g_object_unref (anyaddr);
|
||||
|
@ -381,20 +397,6 @@ gst_net_client_clock_start (GstNetClientClock * self)
|
|||
|
||||
g_object_unref (myaddr);
|
||||
|
||||
/* create target address */
|
||||
inetaddr = g_inet_address_new_from_string (self->priv->address);
|
||||
|
||||
if (inetaddr == NULL)
|
||||
goto bad_address;
|
||||
|
||||
servaddr = g_inet_socket_address_new (inetaddr, self->priv->port);
|
||||
g_object_unref (inetaddr);
|
||||
|
||||
g_assert (servaddr != NULL);
|
||||
|
||||
GST_DEBUG_OBJECT (self, "will communicate with %s:%d", self->priv->address,
|
||||
self->priv->port);
|
||||
|
||||
self->priv->cancel = g_cancellable_new ();
|
||||
self->priv->socket = socket;
|
||||
self->priv->servaddr = G_SOCKET_ADDRESS (servaddr);
|
||||
|
@ -432,7 +434,6 @@ bad_address:
|
|||
{
|
||||
GST_ERROR_OBJECT (self, "inet_address_new_from_string('%s') failed",
|
||||
self->priv->address);
|
||||
g_object_unref (socket);
|
||||
return FALSE;
|
||||
}
|
||||
no_thread:
|
||||
|
|
|
@ -394,7 +394,7 @@ gst_net_time_provider_stop (GstNetTimeProvider * self)
|
|||
/**
|
||||
* gst_net_time_provider_new:
|
||||
* @clock: a #GstClock to export over the network
|
||||
* @address: an address to bind on as a dotted quad (xxx.xxx.xxx.xxx), or NULL
|
||||
* @address: an address to bind on as a dotted quad (xxx.xxx.xxx.xxx), IPv6 address, or NULL
|
||||
* to bind to all addresses
|
||||
* @port: a port to bind on, or 0 to let the kernel choose
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue