udpsrc: fix compilation

Fix compilation on systems MSG_ERRQUEUE and IP_RECVERR.
This commit is contained in:
Wim Taymans 2009-02-25 14:01:26 +01:00
parent 1a2bd6c617
commit 40bc040064

View file

@ -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)
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)
/* 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);