mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
rtsp, multifdsink: Unify the use of union gst_sockaddr.
This commit is contained in:
parent
ec294cc7b2
commit
a038a8d46d
2 changed files with 12 additions and 12 deletions
|
@ -1769,17 +1769,18 @@ gst_rtsp_connection_set_qos_dscp (GstRTSPConnection * conn, guint qos_dscp)
|
|||
{
|
||||
union gst_sockaddr
|
||||
{
|
||||
struct sockaddr_storage sa_s;
|
||||
struct sockaddr_in6 saddr6;
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in6 sa_in6;
|
||||
struct sockaddr_storage sa_stor;
|
||||
} sa;
|
||||
socklen_t sa_sl = sizeof (sa);
|
||||
socklen_t slen = sizeof (sa);
|
||||
gint af;
|
||||
gint tos;
|
||||
|
||||
g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
|
||||
g_return_val_if_fail (conn->fd.fd >= 0, GST_RTSP_EINVAL);
|
||||
|
||||
if (getsockname (conn->fd.fd, (struct sockaddr *) &sa.sa_s, &sa_sl) < 0)
|
||||
if (getsockname (conn->fd.fd, &sa.sa, &slen) < 0)
|
||||
goto no_getsockname;
|
||||
|
||||
af = sa.sa_s.ss_family;
|
||||
|
@ -1787,7 +1788,7 @@ gst_rtsp_connection_set_qos_dscp (GstRTSPConnection * conn, guint qos_dscp)
|
|||
/* if this is an IPv4-mapped address then do IPv4 QoS */
|
||||
if (af == AF_INET6) {
|
||||
|
||||
if (IN6_IS_ADDR_V4MAPPED (&sa.saddr6.sin6_addr))
|
||||
if (IN6_IS_ADDR_V4MAPPED (&sa.sa_in6.sin6_addr))
|
||||
af = AF_INET;
|
||||
}
|
||||
|
||||
|
|
|
@ -703,8 +703,9 @@ setup_dscp_client (GstMultiFdSink * sink, GstTCPClient * client)
|
|||
gint ret;
|
||||
union gst_sockaddr
|
||||
{
|
||||
struct sockaddr_storage ssaddr;
|
||||
struct sockaddr_in6 saddr6;
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in6 sa_in6;
|
||||
struct sockaddr_storage sa_stor;
|
||||
} sa;
|
||||
socklen_t slen = sizeof (sa);
|
||||
gint af;
|
||||
|
@ -713,20 +714,18 @@ setup_dscp_client (GstMultiFdSink * sink, GstTCPClient * client)
|
|||
if (sink->qos_dscp < 0)
|
||||
return 0;
|
||||
|
||||
if ((ret =
|
||||
getsockname (client->fd.fd, (struct sockaddr *) &sa.ssaddr,
|
||||
&slen)) < 0) {
|
||||
if ((ret = getsockname (client->fd.fd, &sa.sa, &slen)) < 0) {
|
||||
GST_DEBUG_OBJECT (sink, "could not get sockname: %s", g_strerror (errno));
|
||||
return ret;
|
||||
}
|
||||
|
||||
af = sa.ssaddr.ss_family;
|
||||
af = sa.sa.sa_family;
|
||||
|
||||
/* if this is an IPv4-mapped address then do IPv4 QoS */
|
||||
if (af == AF_INET6) {
|
||||
|
||||
GST_DEBUG_OBJECT (sink, "check IP6 socket");
|
||||
if (IN6_IS_ADDR_V4MAPPED (&(sa.saddr6.sin6_addr))) {
|
||||
if (IN6_IS_ADDR_V4MAPPED (&(sa.sa_in6.sin6_addr))) {
|
||||
GST_DEBUG_OBJECT (sink, "mapped to IPV4");
|
||||
af = AF_INET;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue