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).
This commit is contained in:
Youness Alaoui 2008-05-01 10:52:11 +00:00 committed by Tim-Philipp Müller
parent 64baa0a0c6
commit 751f2bb364
2 changed files with 26 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2008-05-01 Tim-Philipp Müller <tim.muller at collabora co uk>
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).
2008-04-30 Tim-Philipp Müller <tim.muller at collabora co uk> 2008-04-30 Tim-Philipp Müller <tim.muller at collabora co uk>
* configure.ac: * configure.ac:

View file

@ -434,8 +434,21 @@ no_select:
ret = recvfrom (udpsrc->sock.fd, pktdata, pktsize, ret = recvfrom (udpsrc->sock.fd, pktdata, pktsize,
0, (struct sockaddr *) &tmpaddr, &len); 0, (struct sockaddr *) &tmpaddr, &len);
if (ret < 0) { 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) if (errno != EAGAIN && errno != EINTR)
goto receive_error; goto receive_error;
#endif
} else } else
break; break;
} }
@ -487,8 +500,13 @@ ioctl_failed:
receive_error: receive_error:
{ {
g_free (pktdata); 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), GST_ELEMENT_ERROR (udpsrc, RESOURCE, READ, (NULL),
("receive error %d: %s (%d)", ret, g_strerror (errno), errno)); ("receive error %d: %s (%d)", ret, g_strerror (errno), errno));
#endif
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
skip_error: skip_error: