netutils: Add IPv6 support to QoS DSCP
authorRobert Rosengren <robertr@axis.com>
Tue, 13 Nov 2018 12:39:43 +0000 (13:39 +0100)
committerSebastian Dröge <slomo@coaxion.net>
Mon, 22 Apr 2019 09:01:14 +0000 (09:01 +0000)
Added IPv6 support as already implemented in multiudpsink
(gst-plugins-good).

libs/gst/net/gstnetutils.c

index a8a99d9..7ed3f7f 100644 (file)
@@ -60,6 +60,15 @@ gst_net_utils_set_socket_dscp (GSocket * socket, gint qos_dscp)
   } else {
     ret = TRUE;
   }
+#ifdef IPV6_TCLASS
+  if (g_socket_get_family (socket) == G_SOCKET_FAMILY_IPV6) {
+    if (setsockopt (fd, IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof (tos)) < 0) {
+      GST_ERROR ("could not set TCLASS: %s", g_strerror (errno));
+    } else {
+      ret = TRUE;
+    }
+  }
+#endif
 #endif
 
   return ret;