summaryrefslogtreecommitdiffstats
path: root/gst/udp
diff options
context:
space:
mode:
authorYouness Alaoui <youness.alaoui@collabora.co.uk>2008-05-01 10:52:11 +0000
committerTim-Philipp Müller <tim@centricular.net>2008-05-01 10:52:11 +0000
commit751f2bb3646f2beff3698c9f09900dbd0ea08abb (patch)
tree1ed241e30fca1e6cfa0fb4d95b3af8382d467066 /gst/udp
parent64baa0a0c6d898e8852e6c9d8be7278fafbbb1cb (diff)
gst/udp/gstudpsrc.c: Don't error out if we get an ICMP destination-unreachable message when trying to read packets on...
Original commit message from CVS: Patch by: Youness Alaoui <youness.alaoui at collabora co uk> * gst/udp/gstudpsrc.c: (gst_udpsrc_create): Don't error out if we get an ICMP destination-unreachable message when trying to read packets on win32 (#529454).
Diffstat (limited to 'gst/udp')
-rw-r--r--gst/udp/gstudpsrc.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gst/udp/gstudpsrc.c b/gst/udp/gstudpsrc.c
index 2c0802a3..be150f3e 100644
--- a/gst/udp/gstudpsrc.c
+++ b/gst/udp/gstudpsrc.c
@@ -434,8 +434,21 @@ no_select:
ret = recvfrom (udpsrc->sock.fd, pktdata, pktsize,
0, (struct sockaddr *) &tmpaddr, &len);
if (ret < 0) {
+#ifdef G_OS_WIN32
+ /* WSAECONNRESET for a UDP socket means that a packet sent with udpsink
+ * generated a "port unreachable" ICMP response. We ignore that and try
+ * again. */
+ if (WSAGetLastError () == WSAECONNRESET) {
+ g_free (pktdata);
+ pktdata = NULL;
+ goto retry;
+ }
+ if (WSAGetLastError () != WSAEINTR)
+ goto receive_error;
+#else
if (errno != EAGAIN && errno != EINTR)
goto receive_error;
+#endif
} else
break;
}
@@ -487,8 +500,13 @@ ioctl_failed:
receive_error:
{
g_free (pktdata);
+#ifdef G_OS_WIN32
+ GST_ELEMENT_ERROR (udpsrc, RESOURCE, READ, (NULL),
+ ("receive error %d (WSA error: %d)", ret, WSAGetLastError ()));
+#else
GST_ELEMENT_ERROR (udpsrc, RESOURCE, READ, (NULL),
("receive error %d: %s (%d)", ret, g_strerror (errno), errno));
+#endif
return GST_FLOW_ERROR;
}
skip_error: