Commit 40bc0400 authored by Wim Taymans's avatar Wim Taymans
Browse files

udpsrc: fix compilation

Fix compilation on systems MSG_ERRQUEUE and IP_RECVERR.
parent 1a2bd6c6
...@@ -361,6 +361,7 @@ gst_udpsrc_getcaps (GstBaseSrc * src) ...@@ -361,6 +361,7 @@ gst_udpsrc_getcaps (GstBaseSrc * src)
static void static void
clear_error (GstUDPSrc * udpsrc) clear_error (GstUDPSrc * udpsrc)
{ {
#if defined (MSG_ERRQUEUE)
struct msghdr cmsg; struct msghdr cmsg;
char cbuf[128]; char cbuf[128];
char msgbuf[CMSG_SPACE (128)]; char msgbuf[CMSG_SPACE (128)];
...@@ -384,6 +385,7 @@ clear_error (GstUDPSrc * udpsrc) ...@@ -384,6 +385,7 @@ clear_error (GstUDPSrc * udpsrc)
cmsg.msg_controllen = sizeof (msgbuf); cmsg.msg_controllen = sizeof (msgbuf);
recvmsg (udpsrc->sock.fd, &cmsg, MSG_ERRQUEUE); recvmsg (udpsrc->sock.fd, &cmsg, MSG_ERRQUEUE);
#endif
} }
static GstFlowReturn static GstFlowReturn
...@@ -858,12 +860,14 @@ gst_udpsrc_start (GstBaseSrc * bsrc) ...@@ -858,12 +860,14 @@ gst_udpsrc_start (GstBaseSrc * bsrc)
/* Accept ERRQUEUE to get and flush icmp errors */ /* Accept ERRQUEUE to get and flush icmp errors */
err_val = 1; err_val = 1;
#if defined (IP_RECVERR)
if ((ret = setsockopt (src->sock.fd, IPPROTO_IP, IP_RECVERR, &err_val, if ((ret = setsockopt (src->sock.fd, IPPROTO_IP, IP_RECVERR, &err_val,
sizeof (err_val))) < 0) { sizeof (err_val))) < 0) {
GST_ELEMENT_WARNING (src, RESOURCE, SETTINGS, (NULL), GST_ELEMENT_WARNING (src, RESOURCE, SETTINGS, (NULL),
("could not configure socket for IP_RECVERR %d: %s (%d)", ret, ("could not configure socket for IP_RECVERR %d: %s (%d)", ret,
g_strerror (errno), errno)); g_strerror (errno), errno));
} }
#endif
if (src->auto_multicast && gst_udp_is_multicast (&src->myaddr)) { if (src->auto_multicast && gst_udp_is_multicast (&src->myaddr)) {
GST_DEBUG_OBJECT (src, "joining multicast group %s", src->multi_group); GST_DEBUG_OBJECT (src, "joining multicast group %s", src->multi_group);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment