mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-18 00:13:49 +00:00
gst/udp/gstmultiudpsink.c: Make gst_multiudpsink_render() ignore errors from sendto() instead of breaking streaming. ...
Original commit message from CVS: Patch by: Peter Kjellerstedt <pkj at axis com> * gst/udp/gstmultiudpsink.c: (gst_multiudpsink_render): Make gst_multiudpsink_render() ignore errors from sendto() instead of breaking streaming. Emit a warning instead. Fixes #562572.
This commit is contained in:
parent
24e30c8834
commit
3db0832748
2 changed files with 24 additions and 22 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2008-11-28 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
|
Patch by: Peter Kjellerstedt <pkj at axis com>
|
||||||
|
|
||||||
|
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_render):
|
||||||
|
Make gst_multiudpsink_render() ignore errors from sendto() instead of
|
||||||
|
breaking streaming. Emit a warning instead. Fixes #562572.
|
||||||
|
|
||||||
2008-11-27 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
2008-11-27 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||||
|
|
||||||
Patch by: Ron McOuat <rmcouat at smartt dot com>
|
Patch by: Ron McOuat <rmcouat at smartt dot com>
|
||||||
|
|
|
@ -371,7 +371,7 @@ static GstFlowReturn
|
||||||
gst_multiudpsink_render (GstBaseSink * bsink, GstBuffer * buffer)
|
gst_multiudpsink_render (GstBaseSink * bsink, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
GstMultiUDPSink *sink;
|
GstMultiUDPSink *sink;
|
||||||
gint ret, size, num = 0;
|
gint ret, size, num = 0, no_clients = 0;
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
GList *clients;
|
GList *clients;
|
||||||
gint len;
|
gint len;
|
||||||
|
@ -392,26 +392,30 @@ gst_multiudpsink_render (GstBaseSink * bsink, GstBuffer * buffer)
|
||||||
GstUDPClient *client;
|
GstUDPClient *client;
|
||||||
|
|
||||||
client = (GstUDPClient *) clients->data;
|
client = (GstUDPClient *) clients->data;
|
||||||
num++;
|
no_clients++;
|
||||||
GST_LOG_OBJECT (sink, "sending %d bytes to client %p", size, client);
|
GST_LOG_OBJECT (sink, "sending %d bytes to client %p", size, client);
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
len = gst_udp_get_sockaddr_length (&client->theiraddr);
|
len = gst_udp_get_sockaddr_length (&client->theiraddr);
|
||||||
|
|
||||||
|
ret = sendto (*client->sock,
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
ret = sendto (*client->sock, (char *) data, size, 0,
|
(char *) data,
|
||||||
#else
|
#else
|
||||||
ret = sendto (*client->sock, data, size, 0,
|
data,
|
||||||
#endif
|
#endif
|
||||||
(struct sockaddr *) &client->theiraddr, len);
|
size, 0, (struct sockaddr *) &client->theiraddr, len);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
/* we get a non-posix EPERM on Linux when a firewall rule blocks this
|
/* some error, just warn, it's likely recoverable and we don't want to
|
||||||
* destination. We will simply ignore this. */
|
* break streaming. We break so that we stop retrying for this client. */
|
||||||
if (errno == EPERM)
|
|
||||||
break;
|
|
||||||
if (errno != EINTR && errno != EAGAIN) {
|
if (errno != EINTR && errno != EAGAIN) {
|
||||||
goto send_error;
|
GST_WARNING_OBJECT (sink, "client %p gave error %d (%s)", errno,
|
||||||
|
g_strerror (errno));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
num++;
|
||||||
client->bytes_sent += ret;
|
client->bytes_sent += ret;
|
||||||
client->packets_sent++;
|
client->packets_sent++;
|
||||||
sink->bytes_served += ret;
|
sink->bytes_served += ret;
|
||||||
|
@ -421,20 +425,10 @@ gst_multiudpsink_render (GstBaseSink * bsink, GstBuffer * buffer)
|
||||||
}
|
}
|
||||||
g_mutex_unlock (sink->client_lock);
|
g_mutex_unlock (sink->client_lock);
|
||||||
|
|
||||||
GST_LOG_OBJECT (sink, "sent %d bytes to %d clients", size, num);
|
GST_LOG_OBJECT (sink, "sent %d bytes to %d (of %d) clients", size, num,
|
||||||
|
no_clients);
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
|
|
||||||
/* ERRORS */
|
|
||||||
send_error:
|
|
||||||
{
|
|
||||||
/* if sendto returns an error, something is seriously wrong */
|
|
||||||
g_mutex_unlock (sink->client_lock);
|
|
||||||
GST_DEBUG_OBJECT (sink, "got send error %d: %s", errno, g_strerror (errno));
|
|
||||||
GST_ELEMENT_ERROR (sink, STREAM, FAILED, (NULL),
|
|
||||||
("Got send error %d: %s", errno, g_strerror (errno)));
|
|
||||||
return GST_FLOW_ERROR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue